I also recommend you use the variable name delimiter. So the code would look like:
#!/bin/sh
# $0 is the script name, $1 id the first ARG, $2 is second...
NAME="$1"
mxmlc ${NAME}.as
flashplayerdebugger ${NAME}.sw
This allows the use of the variable in any context, even inside other text. For example:
NewName="myFileIs${NAME}and that is all"
This would expand the variable NAME which would be flanked in front by "myFileIs" and at the back with "and that is all" The variable would expand, spaces included, inside the string. if NAME was "inside here" the NewName would be "myFileIsinside hereand that is all".
The command line can take up to 9 variables. They can be quoted strings which contain blanks, each quoted string counts as a variable. Such as:
./myProg var1 var 2 var3
So ${1}
is "var1"
, ${2}
is "var"
, ${3}
is "2"
, ${4}
is "var3"
BUT:
./myProg var1 "var 2" var3
has ${1}
is "var1"
, ${2}
is "var 2"
, ${3}
is "var3"
Have fun!
$2
is the first argument,$3
the second, and so on.$1
is reserved for the name of the file. As for the other stuff, I don't quite understand what you mean. Could you please try to explain it a little better or write some psuedocode? – fouric Aug 15 '12 at 23:36"$1"
is the first argument. – geirha Aug 17 '12 at 13:20