Category: Bash

  • About bash builtin command named “eval”

    ABOUT eval eval is a builtin command of the Bash shell. It concatenates its arguments into a single string, joining the arguments with spaces, then executes that string as a bash command. It’s similar to running bash -c “string”, but eval executes the command in the current shell environment rather than creating a child shell […]

  • 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 […]

  • Look into bash builtin command named typeset

    $typeset -n gree=55 bash: typeset: 55′: invalid variable name for name reference $typeset -n 55=gree bash: typeset:55=gree’: not a valid identifier$typeset -n gree=pwd$echo $gree $echo $pwd $typeset -n vary=$?bash: typeset: `0′: invalid variable name for name reference$typeset vary=$?$echo $vary1$echo $vary1$echo $?0$echo $vary1$echo varyvary$echo $vary1$echo $vary1$echo $?0$typeset vary=$?$echo $vary0$ $typeset hello $echo $hello $echo $? 0 […]

  • How to use dirs, pushd and popd commands ?

    $pushd upstream-kernel/ ~/upstream-kernel ~ $pwd /home/jeffrin/upstream-kernel $cd .. $pushd temp/ ~/temp ~ ~ $dirs ~/temp ~ ~ $dirs -l /home/jeffrin/temp /home/jeffrin /home/jeffrin $pwd /home/jeffrin/temp $pushd ../upstream-kernel/ ~/upstream-kernel ~/temp ~ ~ $dirs -l /home/jeffrin/upstream-kernel /home/jeffrin/temp /home/jeffrin /home/jeffrin $pushd ../testing/ ~/testing ~/upstream-kernel ~/temp ~ ~ $dirs -l /home/jeffrin/testing /home/jeffrin/upstream-kernel /home/jeffrin/temp /home/jeffrin /home/jeffrin $popd ~/upstream-kernel ~/temp ~ ~ […]

  • finding source code or source file of a typical bash function

    $type -a signals bash: type: signals: not found $type -a _signals _signals is a function _signals () { local -a sigs=($( compgen -P “$1” -A signal “SIG${cur#$1}” )); COMPREPLY+=(“${sigs[@]/#${1}SIG/${1}}”) } $declare -F _signals _signals $shopt -s extdebug $declare -F _signals _signals 862 /usr/share/bash-completion/bash_completion $declare -F _command _command 1732 /usr/share/bash-completion/bash_completion $declare -F compgen $declare -F _grub_dirs […]

  • compgen builtin command exposure

    ABOUT compgen compgen is bash built-in command and it will show all available commands, aliases, and functions for you. TYPICAL COMMANDLINE EXPOSURE RELATED [bash] $compgen -k if then else elif fi case esac for select while until do done in function time { } ! [[ ]] coproc $ $compgen -a ls $ $compgen -b […]

  • bash builtin command named command

    $pwd /home/jeffrin/upstream-kernel $tail ~/.bashrc . /usr/share/bash-completion/bash_completion elif [ -f /etc/bash_completion ]; then . /etc/bash_completion fi fi export PS1=$ function ls { pwd } $ls /home/jeffrin/upstream-kernel $command ls 0002-Testing-script-for-Intel-P-State-driver-crashes-duri.patch linux linux-kselftest linux-kselftest.bup linux-kselftest.bup2 linux-next linux.old $

  • Extracting the second word from a string variable

    https://unix.stackexchange.com/questions/174037/extracting-the-second-word-from-a-string-variable

  • How do I get the parent process ID of a given child process?

    https://askubuntu.com/questions/153976/how-do-i-get-the-parent-process-id-of-a-given-child-process https://superuser.com/questions/150117/how-to-get-parent-pid-of-a-given-process-in-gnu-linux-from-command-line/544696#544696

  • Indicate how each name would be interpreted if used as a command name

    $type -a locate locate is /usr/bin/locate $type -a ls ls is aliased to `ls –color=auto’ ls is /bin/ls $type -t ls alias $type -t locate file $type -t /dev/urandom $type -t /dev/sda1 $type -t urandom $type -t sda1 $type -t type builtin $type -t shuf file $type -t bash file $type -t proc $type -t […]