September 14, 2022

Bash Builtin Colon

: is a shell builtin command inherited from the Bourne Shell. It does nothing beyond expanding arguments and performing redirection and has return status zero. : is a no-op operator similar to true and false. In fact, command true and : both use the same function int colon_builtin() underneath. Parameter expansions Shell’s parameter expansions are used to check and modify parameters. Below illustrated how : is used in parameter expansion by setting a default value combined with :. Read more

August 30, 2022

Bash builtin Read

The bash read command is a built-in utility that read text from the standard input. Bash Read Syntax The syntax for read command is: read <options> <arguements> The read command reads a line from the standard input and split it into fields, assigning each word to an arguement. If there are leftover words, they are assigned to the last arguement. $ read user_input this is my text $ echo $user_input this is my text $ read var1 var2 var3 there are 3 arguements $ echo $var1 there $ echo $var2 are $ echo $var3 3 arguements $REPLY $REPLY is the default variable used by the read builtin. Read more

August 1, 2022

Bash Shortcut: Ctrl and Alt keys

Commands for moving Ctrl + a: move to the beginning of line Ctrl + e: move to end of line Ctrl + f: Move forward a character Ctrl + b: Move back a character Alt + f: Move forward to the end of the next word Alt + b: Move back to the start of the current of previsous word Commands for Manipulating the History Ctrl + n: Fetch the next command form the history list (same as Down arrow) Ctrl + p: Fetch the previous command form the history list (same as Up arrow) Alt + <: Move to the first line in the history ALt + >: Move to the end of the input history ( the line currently bein entered) Ctrl + r: begins a backward search through command history Alt + p: Search backward through the history using a non-incremental search for a string supplied by the usser Alt + n: Search forward through the history using a non-incremental search for a string supplied by the usser Alt + . Read more

Powered by Hugo & Kiss.