Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

Shell command, operator and separator/control characters:

|  = pipe will take the first commands stdout as the second commands stdin.
|| = OR if first command is false, it will take the second.
|= = OR IS (mostly used in if statements)
&& = AND if first command is true, it will execute the second one.
!  = NOT (mostly used in if and test statements), but as a shell-command
     it opens a shell to run the command (ex. `! echo foo`)
!= = NOT IS (mostly used in if statements)
!$ = last commands last argument
!! = repeat last command
=  = IS (mostly used in if statements)
;  = will separate 2 commands as if they were written on separate command lines
;; = end of a case function in a case statement. (see 'case' further down)
$  = prefix to a variable like "$myvar"
$! = PID of the last child process.
$$ = PID of current process (PID == Process ID)
$0 = Shows program that owns the current process.
$1 = First argument supplied after the program/function on execution.
$2 = Second argument supplied after the program/function on execution. ($3 etc.)
$# = Shows the number of arguments.
$? = Any argument (good to use in 'if' statements)
$- = current option flags (I never ever had to use this one)
$_ = Last argument/Command
$* = All arguments
$@ = All arguments
#  = remmed line, anything on a line after "#" will be overlooked by the script
{  = start braces (starts a function)
}  = end braces   (ends a function)
[  = start bracket (multiple-argument specifiers)
]  = end bracket (multiple-argument specifiers)
@  = $@ is equivalent to "$1" "$2" etc. (all arguments)
*  = wild card (* can substitute any number of characters)
?  = wild card (? can substitute any single character)
"  = quote
'  = precise quote. (Will even include "'s in the quote)
`  = command quote. (variable=`ls -la` doing $variable will show the dir list)
.  = dot will read and execute commands from a file, ( . .bashrc )
&  = and. as suffix to executed file makes it go to the background(./program &)
0> = stdin stream director (I never seen this used in any script)
1> = stdout stream director (standard output)
2> = stderr stream director (standard error output)
%  = job character, %1 = fg job 1, %2 = fg job 2, etc.
>> = stream director append to a file
<< = stdin stream director. (cat > file << EOF ; anything ; EOF)
>  = stream director that will start at the top of the file
    (in if statements < and > may be used as greater-than
    and lesser-than, as: if [ "$1" >= "2" ])
  = back-slash, takes away any special meaning with a character,
     $var will not be treated as a variable.
     (and a new line will not be treated as a new line)
     Also a  before a command, removes any alias on the command as: 
m
>& = stream director to stream director, ie. echo "a" 1>/dev/null 2>&1
     this directs 2> to the same place as 1>
Comment

PREVIOUS NEXT
Code Example
Shell :: ionic capacitor file-chooser 
Shell :: windows key not raising window in ubuntu 
Shell :: install ambrella uml ubuntu 
Shell :: service account impersonation google gcp application credentials 
Shell :: eval assignment 
Shell :: output format is WPS Path to intermediate files is ./ ERROR: edition_num: unable to open GRIBFILE.AAA 
Shell :: fish shell ssh agent autostart 
Shell :: Copying file permission of unixcop to monitor.txt 
Shell :: masking 
Shell :: cashier paddle installation 
Shell :: How to turn on ARD on mac using terminal 
Shell :: redis bitnami/redis kubernetes and docker-compose 
Shell :: remove telegraf from dembian 
Shell :: &quot;scrapy shell&quot; pass cookies to fetch 
Shell :: OFS linux 
Shell :: Error installing a pod - Bus Error at 0x00000001045b8000 
Shell :: check_mk ubuntu 20.04 
Shell :: Authenticate with a GitHub host. 
Shell :: How To Edit Log File On Batch Script 
Shell :: ubuntu mouse lost focus 
Shell :: linux manjaro tg link 
Shell :: docker how to run existing container 
Shell :: gitignore a specific file 
Shell :: ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied 
Shell :: download teamviewer for ubuntu 20.04 
Shell :: wget destination filename 
Shell :: how to tell if i have cuda installed 
Shell :: install youtube-dl on ubuntu 20.04 
Shell :: linux date command live update 
Shell :: how to sync my directory with my deleted file change 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =