Tag: bash

  • Sessions of bash builtin command named “times”

    ABOUT times Print the accumulated user and system times for the shell and for processes run from the shell [bash] $times 0m0.063s 0m0.024s 0m0.008s 0m0.012s $times pin 0m0.064s 0m0.025s 0m0.008s 0m0.012s $times ping 0m0.065s 0m0.025s 0m0.008s 0m0.012s $times –help times: times Display process times. Prints the accumulated user and system times for the shell and…

  • Fundamentals related to a bash builtin command named “test”

    ABOUT test test provides no output, but returns 0 for “true” (test successful) and 1 for “false” (test failed). RELATED COMMAND LINE EXPOSURE [bash] $num=10; if (test $num -gt 5); then echo "yes"; else echo "no"; fi yes $num=1; if (test $num -gt 5); then echo "yes"; else echo "no"; fi no $num=5; if (test…

  • Fundamentals related to bash builtin command named “shift”

    ABOUT shift shift [n] The positional parameters from n+1 … are renamed to $1 …. Parameters represented by the numbers $# down to $#-n+1 are unset. n must be a non-negative number less than or equal to $#. If n is 0, no parameters are changed. If n is not given, it is assumed to…

  • How to use bash builtin command named “readonly” ?

    ABOUT readonly Marks name specified by Name parameter as read-only. TYPICAL COMMANDLINE SESSION [bash] $a=1 $a=2 $echo $a 2 $readonly a $a=1 bash: a: readonly variable $echo $a 2 $a=2 bash: a: readonly variable $ [/bash] LINK https://www.ibm.com/support/knowledgecenter/ssw_aix_72/com.ibm.aix.osdevice/bourne_shell_builtin_cmd_list.htm

  • A bash builtin command named “enable” to enable or disable a bash builtin command

    [bash light=”true”] $command $echo $? 0 $enable -n command $command bash: command: command not found $echo $? 127 $enable command $command $enable -n enable $enable bash: enable: command not found $ [/bash] RELATED SOURCE CODE EXPOSURE [c light=”true”] /* Enable/disable shell commands present in LIST. If list is not specified, then print out a list…

  • Hacking with the quote command on Bash shell

    ABOUT Quoting Quoting is used to remove the special meaning of certain characters or words to the shell. Quoting can be used to disable special treatment for special characters, to prevent reserved words from being recognized as such, and to prevent parameter expansion. Each of the shell metacharacters (*note Definitions::) has special meaning to the…

  • What does the command “netstat ” do ?

    ABOUT netstat In computing, netstat (network statistics) is a command-line network utility tool that displays network connections for the Transmission Control Protocol (both incoming and outgoing), routing tables, and a number of network interface (network interface controller or software-defined network interface) and network protocol statistics. It is available on Unix-like operating systems including macOS, Linux,…

  • Handling File Name With Space

    commandline session $ > test file Usage: file [-bchikLlNnprsvz0] [–apple] [–mime-encoding] [–mime-type] [-e testname] [-F separator] [-f namefile] [-m magicfiles] file … file -C [-m magicfiles] file [–help] $ls test $ls -l total 0 -rw-r–r– 1 jeffrin jeffrin 0 Nov 8 23:59 test $> “test file” $ls test test file $ls -l total 0 -rw-r–r–…

  • coproc is a shell keyword related to coprocesses in GNU Bash

    ABOUT coproc Bash 4.0 introduced coprocesses, a feature certainly familiar to ksh users. The coproc keyword starts a command as a background job, setting up pipes connected to both its stdin and stdout so that you can interact with it bidirectionally. Optionally, the co-process can have a name NAME. If NAME is given, the command…

  • tee – read from standard input and write to standard output and files

    A UNIX Command $tee name my name is nice. my name is nice. $cat name my name is nice. $ UNIX Explanation Copy standard input to each FILE, and also to standard output. A special variant of the tee for the shell is called script and permits duplicating all input commands submitted to a shell…