chmod

1. chmod –x scr1.sh
2. What is $1

Just a few questions to ask.
I'm pretty sure about the first code but not the second code

1. makes scr1.sh to not executable

2. what does $1 do in linux script

thank you for your help.
bt1942Asked:
Who is Participating?
 
Gerwin Jansen, EE MVETopic Advisor Commented:
Try creating a basic script like this:

echo "Your first parameter is: $1"

and call the script like this:

sh yourscript.sh something

it should echo this:

Your first parameter is something

And:

chmod -x removes all x bits from the file so if the file's protection was:

rwxr-xr-x

after chmod -x it would become:

rw-r--r--
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
$1 is the first parameter you give to the script on the command line
0
 
Jared_SCommented:
$1 is a variable that represents the first argument on a command line
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.