Labels

Monday, April 2, 2012

Shell+Script Learning Notes--Basic

1.              To display the current Shell that you are in
# echo $SHELL
2.              How to check the bash shell version
# bash -version
GNU bash, version 3.2.48(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.

3.              There are two ways you can execute this script.

The first is by “sourcing” the script. All this did was send the lines in your file except for those that started with the # to the current shell. So running the script is identical to typing the following at the command prompt
$ . ./simple.sh

The other way you can execute your script is to make it executable and use it as a command.
$ ./simple.sh

specify which shell to run within your script.  #!/bin/bash at the beginning of your script.

No comments:

Post a Comment