bash

A shell script is a text file that typically begins with a shebang, as follows:
#!/bin/bash
For any scripting language in a Linux environment, a script starts with a special line called
shebang. Shebang is a line for which #!


# id
uid=0(root) gid=0(root)
# su oracle
# id
uid=100(oracle) gid=100(oinstall)
#
#
# su - oracle
Password:
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
-bash-3.00$
---------------------


bash-3.00# echo this is a test line > input.txt
bash-3.00# exec 3< input.txt
#now we can use descriptor
bash-3.00# cat <&3
this is a test line
-------------------
bash-3.00# echo $0
bash

bash-3.00# ls + 2>out.txt
bash-3.00# ls
out.txt
bash-3.00# cat out.txt
+: No such file or directory
bash-3.00# ls +
+: No such file or directory



bash: ./sc.sh: Permission denied

bash-3.00# bash ./sc.sh
Sun Apr 10 16:11:29 MSD 2011
test

bash-3.00# bash -x ./sc.sh
+ date
Sun Apr 10 16:11:41 MSD 2011
+ sleep 2
+ echo test
test
+ sleep 1
+ who

bash-3.00# cat sc.sh
#!/bin/bash
date;
sleep 2;
echo test;
sleep 1;
who > 1.txt;
------------------------
$ echo Hello world !
Or:
$ echo 'Hello world !'
Or:
$ echo "Hello world \!" #Escape character \ prefixed.

Comments

Popular posts from this blog

HAproxy logging

teamcity Automatic Agent Start under Linux

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all