Writing scripts with arguments?
You could use something like this:
#!/bin/sh
# $0 is the script name, $1 id the first ARG, $2 is second...
NAME="$1"
mxmlc $NAME.as
flashplayerdebugger $NAME.swf
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!