A little bit of history

By  

With an s (set) argument, shopt turns a feature on while with a u (unset) argument, it turns them off.

$ shopt
cdable_vars     off
cdspell         off
checkhash       off
checkwinsize    on
cmdhist         on
dotglob         off
execfail        off
expand_aliases  on
extdebug        off
extglob         off
extquote        on
failglob        off
force_fignore   on
gnu_errfmt      off
histappend      off
histreedit      off
histverify      off
hostcomplete    on
huponexit       off
interactive_comments    on
lithist         off
login_shell     on
mailwarn        off
no_empty_cmd_completion off
nocaseglob      off
nocasematch     off
nullglob        off
progcomp        on
promptvars      on
restricted_shell        off
shift_verbose   off
sourcepath      on
xpg_echo        off

If you disable the cmdhist setting by using the command shopt -u cmdhist, multi-line commands that previously would have been stored in a single line of your history file will be stored on multiple lines like so:

   21  for num in 1 2 3
   22  do
   23    echo $num is nice
   24  done

This might be useful if the complexity of your commands is all in the first line and maybe you want to issue a series of very different commands from different locations in your file systems within your do ... done. In any case, it's there should you find this option useful.

Those who cannot learn from history are bound to repeat it. Then again, so are those who do!

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Operating SystemsWhite Papers & Webcasts

See more White Papers | Webcasts

Answers - Powered by ITworld

ITworld Answers helps you solve problems and share expertise. Ask a question or take a crack at answering the new questions below.

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Ask a Question