Download presentation
Presentation is loading. Please wait.
Published byRolf Walters Modified over 9 years ago
1
Scripting CBIS 4225
2
BASH Scripting Step 1 – Create the bash file. Usually a good idea to end it in.sh file1.sh Step 2 – Using CHMOD make the bash file executable Step 3 – To run the script navigate to the folder where the script is and type a./ in front of the file name to execute.
3
BASH Syntax #!/bin/bash (always goes at the very top) echo "Hello, World“ (echo is used to present text)
4
BASH Variables Input var1=“boo”(note no spaces) echo $var1 (note the dollar sign in front to use it) Output boo var1=0 (this would be a number; since there are no quotes)
5
BASH Inputs read is the keyword to get the user input Example read var1 echo $var1 Output Whatever the person typed in.
6
IF Statements if [something] then elif then elif then else fi echo "Please enter type of fruit" read fruit if [ $fruit = apple ] then echo "Good, I like Apples" else echo "Oh no, I hate Oranges!" fi
7
#1 Create a script called userinfo that takes input (username) from a user and outputs the users information to the screen. #2 Create a script that outputs the difference between two numbers received from a user. #3 Create a script that will go to a text document with a list of users and create new user for each member in the list. You will also need to create a password for them and set it so they need to change their password no the next login. Set the password to expire after 3 months. Hint: You will need a loop for the last one.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.