Help - Search - Members - Calendar
Full Version: what's $3 $2 $1 etc mean?
InsanelyMac Forum > Apple World > Mac Programming and Development
J o e l
bless -mount "$3/" -setBoot and "$1/Contents/Resources/SetHidden" "$3" \

what do they mean? the $3 and $1. i've tried googling but i dont know what to look for.
lord_muad_dib
that lne is inserted on a bash script? if yes, they are the "arguments" you insert in the command line
J o e l
QUOTE
#!/bin/sh

"$1/Contents/Resources/SetHidden" "$3" \
"$1/Contents/Resources/hidden_MacOS9"


if [ "x$CF_USER_DATA_STRING" != "x" ]; then
echo "$CF_USER_DATA_STRING" > "$3/var/root/.CFUserTextEncoding";
"$3/usr/sbin/chown" -f root:wheel "$3/var/root/.CFUserTextEncoding";
"$3/bin/chmod" -f 644 "$3/var/root/.CFUserTextEncoding";
fi

bless -mount "$3/" -setBoot

diskutil repairPermissions "$3/"

"$3/bin/chmod" -R 755 "$3/System/Library/Extensions/"

"$3/usr/sbin/chown" -R root:wheel "$3/System/Library/Extensions/"

"$1/Contents/Resources/SetHidden" "$3" \
"$1/Contents/Resources/hidden_MacOS9"

diskutil repairPermissions "$3/"

exit 0


alright so it must be something=$1? but the above code does not have that line. could you explain?
FreemanTP
assuming the scripts name is "myscript.sh"
you would start it from the Terminal like this:

CODE
./myscript arg1 arg2 arg3


Within the script you could access those arguments with $1,$2 and $3
$0 is usually the name of the called executable, in this case myscript.sh
J o e l
alright. i got that part. thanks you.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.