Showing posts with label Shell. Show all posts
Showing posts with label Shell. Show all posts

PATH Variable Empty Component

Empty Component in $PATH means "Current directory".

If you wish to include  the current directory in the search path.You need to keep ":" in $PATH.

Eg:
PATH=:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin Current directory first
PATH=/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin: Current directory last
PATH=/bin:/usr/bin:/usr/X11R6/bin::/usr/local/bin Current directory in middle

With above you can execute the scripts directly from your current path without ./ .

Korn Shell Tips


1.  To erase  ^?^?^?    when typing backspace.

      # stty erase ^?

2.  To activate  esc key functions. To navigate the command line like a vi session
   
       #   set -o vi


While Loop

Execute controlled  while loop .



Shell Tips and Tricks


Command Line Short cuts:

1.  You can edit  previous command/one liner in vi editor simply by pressing  "v". This takes the shell into vi mode.

Eg:      # for i in 0 1
            > do
            >  lspv | grep hdisk$i
            > done


Press  Esc+k


 Press  v

   
Update the Script, Added  2 3 and  press  :wq!  < To save and exit>


Now the command/Oneliner is executed .