Posts

Showing posts from October, 2016

linux variables

To set variable  only  for current shell: VARNAME = "my value" To set it for current shell and  all processes  started from current shell: export VARNAME = "my value" # shorter, less portable version To set it  permanently  for all future bash sessions add such line to your  .bashrc  file in your  $HOME directory. To set it permanently, and  system wide  (all users, all processes) add set variable in /etc/environment: gksudo gedit / etc / environment

4 Ways of Executing a Shell Script in UNIX / Linux

1. Execute Shell Script Using File Name Use the shell script file name to execute it either by using it’s relative path or absolute path as shown below. $ cd /home/sathiya $ ./scriptfile (or) $ /home/sathiya/scriptfile If you have the shebang, then it will be executed using the command interpreter specified in the shebang. If you are beginner in shell scripting, refer our earlier article  Shell Script Execution Guidelines for Newbies 2. Execute Shell SCript by Specifying the Interpreter You can also execute a unix shell script by specifying the interpreter in the command line as shown below. Execute using sh interpreter $ sh scriptfile Execute using bash interpreter $ bash scriptfile Irrespective of what is being used as shebang, the interpreter which you have specified will be used for execution. You can use any interpreter (sh, ksh, bash, csh etc.,). 3. Execute Shell Script Using .  ./ (dot space dot slash) While executing the shell script using “dot...