[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 719
  • Last Modified:

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.
0
bt1942
Asked:
bt1942
  • 2
3 Solutions
 
Gerwin Jansen, EE MVETopic Advisor Commented:
$1 is the first parameter you give to the script on the command line
0
 
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
 
Jared_SCommented:
$1 is a variable that represents the first argument on a command line
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now