replace filename with variable
what my script needs:
i want to be able to use a filename in my script several times, and i want to use this script hundreds of times for different files, without having to manually change the filename over and over each time i want it run. so for example, maybe the script is run with*: Code:
$ wabob foo.png so what ways are there of achieving this? (preferably just using bash... but if something else (C?) is required, very well..) * i dont mind if i just run it with "wabob", and it prompts me for the filename. either way is good i suppose. ps, sry if this is something painfully simple i've overlooked while reading about bash. |
You can use the positional variable $1
Whatever you pass as the first argument (can be the name of your file) will be assigned to this variable. You can access it within the script by eg: Quote:
HTH |
You'll find these links educational
http://rute.2038bug.com/index.html.gz http://tldp.org/LDP/Bash-Beginners-G...tml/index.html http://www.tldp.org/LDP/abs/html/ |
All times are GMT -5. The time now is 08:35 PM. |