Linux Shell Scripting part -1
touch: first-shell-script.sh ( creating shell script file)
man touch ( man is used to tell the user about the command information like what touch means)
vim second_shell_script.sh ( it will create the file and open it)
Difference between vim and touch ( both the commands will create the files, but vim will create the file and open it , whereas touch will just create it, when we need to create multiple files while doing automation, we have to use touch)
#!/bin/bash
#! - shebang
#!/bin/bash
bash-- executable (there will be multiple executabales like bash, ksh, sh, dash but mostly bash is used . the difference in all the executables lies in the syntax)
if we use #!/bin/sh -- previously it went to bash, but now it will go by default to dash
echo "my name is yasmeen"
echo is used to print the output
cat first_shell_script.sh -- cat is used to print the contents of the file
Executing the shell script file
sh first_shell_script.sh or ./first_shell_script.sh
when you execute the above command you will get error that permission denied, so we need to edit the permissions using chmod
chmod(Change mod) : grants permission to a file
chmod has three digits( first digit represents what permission we have , second represents what permission group has , third represents what permission all users have)
4-read, 2-write, 1-execute
ex: 444 (read, read, read - all the users have read permission)
history : shows history of all commands ran
# is used to comment inside shell script