tsunam
Thread Starter
- Joined
- Sep 14, 2003
- Messages
- 1,240
Alright, here's one for you all.
I have a script that currently requires a user to do a
./program.sh file.img /dev/sda
to get it to run properly.
I've decided that since more people are going to be creating the applications onto the flash cards that I need to modify it so that instead of having to type that in and be bugged about the proper format that I'll just do a few prompts to tell them what they need to put in.
Basically what I have so far is
echo "what is the image you wish to copy? filename.img"
read $1
dp=1
while [ $dp != "0" ] do
dd if=$2 of=/dev/null bs=512 count=1
dp=$?
done
sync
echo ... Copied $1 to $2
of course all the $2 can either be a prompt or I can just set it to what it will be since no one will be modifying what /dev/sda its on or where its mounted to.
However the problem i'm having is that when it goes to the read $1 and it gives the blank space to type...it doesn't allow for tab completition to follow. That's something I need to be able to do since People don't want to Write down a 40 character named .img. -_- making modifications for windows people bleh! (is it possible to still have a tab completition? if not well maybe a ./program.sh and it automatically does a --help file that would explain how to use it?)
any help would be appreciated. (yes this is a shortened form of the actual exact program but gives a idea of what I'm doing.)
I have a script that currently requires a user to do a
./program.sh file.img /dev/sda
to get it to run properly.
I've decided that since more people are going to be creating the applications onto the flash cards that I need to modify it so that instead of having to type that in and be bugged about the proper format that I'll just do a few prompts to tell them what they need to put in.
Basically what I have so far is
echo "what is the image you wish to copy? filename.img"
read $1
dp=1
while [ $dp != "0" ] do
dd if=$2 of=/dev/null bs=512 count=1
dp=$?
done
sync
echo ... Copied $1 to $2
of course all the $2 can either be a prompt or I can just set it to what it will be since no one will be modifying what /dev/sda its on or where its mounted to.
However the problem i'm having is that when it goes to the read $1 and it gives the blank space to type...it doesn't allow for tab completition to follow. That's something I need to be able to do since People don't want to Write down a 40 character named .img. -_- making modifications for windows people bleh! (is it possible to still have a tab completition? if not well maybe a ./program.sh and it automatically does a --help file that would explain how to use it?)
any help would be appreciated. (yes this is a shortened form of the actual exact program but gives a idea of what I'm doing.)