





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






Shell Scripting Relevance - ANSWER -1. Create own Commands
First line of a shell script - ANSWER -#!/bin/bash Comments in shell - ANSWER -# Components of chmod - ANSWER -Category of user (user, group, other, all) Operation (+, -, =) Permission type (Read, write, execute) Tells unix that the file is executable - ANSWER -chmod u+x file.sh chmod +x file.sh Execute the shell script called file.sh - ANSWER -./file.sh
. file.sh source file.sh sh file.sh Quote Characters - ANSWER -1. Double Quote
Read permission - ANSWER -ls can read the list of filesnames stored in that directory Write permission - ANSWER -Permitted to create or remove files within the directory Execute permission - ANSWER -User is permitted to pass through the directory in searching for subdirectories Programming features of the UNIX/LINUX shell - ANSWER -1. Shell variables
Special Variables - ANSWER -Positional parameters $1, $2.. echo $1 refers to the first string after the name of the script file Operators - ANSWER -Shell scripts support many operators, including those for performing mathematical operations 3 Groups of Operators - ANSWER -1. Defining and evaluating operators
Variable that contains the name of the script - ANSWER -$ Command line parameter - ANSWER -$1, $2..... Number of command line parameters - ANSWER -$# process ID of the shell - ANSWER -$$ Return exit code of the last command - ANSWER -$? Shift Command - ANSWER -Shifts the positional parameters by one towards the beginning and drops $1 from the list, so that $ becomes $1 and so on List all the positional parameters one by one (across screen) - ANSWER -$* List all the positional parameters - ANSWER -$@ TESTS IN SHELL SCRIPTING - ANSWER - int1 -eq int2 - ANSWER -Test identity int1 -ne int2 - ANSWER -Test inequality
int1 -lt int2 - ANSWER -Less than int1 -gt int2 - ANSWER -Greater than int1 -le int2 - ANSWER -Less than or equal to int1 -ge int2 - ANSWER -Greater than or equal to s1 = s2 OR s1 == s2 - ANSWER -Tests equality s1 != s2 - ANSWER -Tests inequality string OR -n string - ANSWER -Returns exit status 0 if string isn't null -z string - ANSWER -Returns exit status 0 if string is null Equivalent to &&/|| - ANSWER --a and -o [ ] - ANSWER -Used to test Test if file is a directory - ANSWER --d file Test if file is not a directory - ANSWER --f file