1.ORACLE_SID=lsh
2.export ORACLE_SID
3.#!/bin/bash
4.Shell variables are un-typed and may contain integer or text,Number with a decimal point will be treated as text(3.14)
5.variable scope: local script or all session. when export variable, variable are used in subsequently.
6.$ORACLE_SID use variable
${ORACLE_SID}_SID
7.echo $ORACLE_SID
8.# this is comment
9. scriptname.sh
10.chmod ugo+x scriptname.sh
11. ./name.sh
12.[ $ORACLE_SID="lsh" ] conditional testing ,
13.if
then
fi
if
then
elif
then
else
fi
14. matmathics comparators
-lt <
-le <=
-gt >
-ge >=
-eq =
-ne !=
15.string comparators
=
!=
string
16.file comparators
-nt
-ot
-e
-d
-h
-s
-r
-w
-x
-f
17.complex comparator
-a
-o
!
18.if [ $ORACLE_SID="lsh" ]
19.if [ $ORACLE_SID -lt 30 ]
20.if [ -e /u01/oracle/bin.sqlplus ]
21.if [ -e /u01/oracle/dbs/spfile${ORACLE_SID}.ora -a -e $ORACLE_SID/dbs/init$ORACLE_SID.ora ]
22.if [ $ORACLE_SID ] check variable
22.ps -ef | grep "$ORACLE_SID"
23. case in matching string
a)
echo "" ;;
b)
echo "" ;;
c)
echo "";;
*)
echo "";;
esac
24. while [ $ORACLE_SID="lsh" ]; do
echo ""
i=`expr $i + 1`
done
25.for var in 1 a 3;do
echo ""
done
26.break; continue;
27.[ -r /u01/oracle ] && echo "this is"
[ -r /u01/orace ] || { echo "can not read"; exit 1; }
28.{ echo "can not write" ; exit 1 ; } anymous function
29.$1,$2,$3
var=$1 specify the value of var is from running parameter
$* //specify all the parameters
for var in $*;do ./test 1 2 3
echo "===$var==="
done
$#//specify the numbersof all the parameters
30.
#!/bin/sh
echo “What is your favourite OS?”
select var in “Linux” “Gnu Hurd” “Free BSD” “Other”; do
break;
done
echo “You have selected $var”
What is your favourite OS?
1) Linux
2) Gnu Hurd
3) Free BSD
4) Other
#? 1
You have selected Linux
31."$SHELL"
'*.jpg'
"/$SHELL"
34.
#!/bin/bash
help() //must first declare, then use fun.
{
cat << HELP
"this is lp"
HELP
exit 0
}
[ -n "$SHELL" ]&&help
35.
"$SHELL"
'$SHELL'
"*.jpg"
Prevent the wildcard(*) and variable expansion
32.cat <<help
sdsdsd
sds
help
Here Document:When you want to pass a few lines of text to a command,we use <<help ------------help
33.exit 0 exit function
34.sh -x test.sh
sh -n test.sh
35.shift remove the first parameter from parameter list
shift 1
shift 2
36.ctrl+a !!
ctrl+e !$
ctrl+l
ctrl+u
ctrl+k
ctrl+y
ctrl+r
ctrl+c
ctrl+d
ctrl+z
./runinstall&
37. ls;pwd;date Multiple commands separated by semicolons in the line.
(ls;date;pwd)>cat.bbk
38.type pwd
39.alias vi=vim
alias ll='ls-l'
unalias vi
40.cd /var/log
cat /dev/null >message
cat /dev/null >wtmp
41.echo "this is `pwd` directory" `pwd` Command substitution
42.echo ${name} display variable
unset name clear variable
set display all variable
43.name=bbk
readonly bbk
44.PATH=${PATH}:/bin/bash
${#PATH} the length of the PATH
45.arry=(abc bb cc dd)
echo ${#arry}
echo ${#arry[*]}
echo ${#arry[1]}
echo ${#arry[2]}
echo ${arry[0]}
46.#!bin/bash
dno=$1
sqlplus hr/hr <<EOF >select.sql
select * from emp where deptno=$dno;
EOF
47.name=lsh
echo 'this is $name'
this is $name
47.> redirect standoutput
>>
2> redirect errorout
2>>
48.ps -ef | grep oracle
This is "\"
48.
分享到:
相关推荐
Learn shell scripting to solve complex shell-related problems and to efficiently automate your day-to-day tasks About This Book Familiarize yourself with the terminal by learning about powerful shell...
Shell Scripting Learn Linux Shell Programming Step-By-Step 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载...
Shell Scripting Learn Linux Shell Programming Step-By-Step 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
Shell Scripting Learn Linux Shell Programming Step-By-Step 英文azw3 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
Learning Linux Shell Scripting is ideal for those who are proficient at working with Linux and want to learn about shell scripting to improve their efficiency and practical skills. Table of Contents ...
Learn about various conditional statements' code snippets, and realize the power of repetition and loops in your shell script. Implement functions and edit files using the Stream Editor, script in ...
Linux for Hackers:Learn Cybersecurity Principles With Shell,python,bash Programming Using Kali Linux Tools. A Complete Guide
在计算机科学中,Shell俗称壳(用来区别于核),是指“提供使用者使用界面”的软件(命令解析器)。它类似于DOS下的command.com。它接收用户命令,然后调用相应的应用程序。同时它又是一种程序设计语言。
shell. Then, you'll learn how to write a simple bash script and how to edit your bash script using Linux editors. Following this, you will learn how to define a variable and the visibility of a ...
Starting with the basics of the shell, you will learn simple commands and how to apply them to real-world issues. From there, you'll learn text processing, web interactions, network and system ...
linux-shell-scripting-fundamentals-bash.epub
Learn about various conditional statements' code snippets, and realize the power of repetition and loops in your shell script. Implement functions and edit files using the Stream Editor, script in ...
Learn_shell 学习Linux Shell脚本的存储库
SHELL LIUNX LEARN
Learn about various conditional statements' code snippets, and realize the power of repetition and loops in your shell script. Implement functions and edit files using the Stream Editor, script in ...
Learn how to… Take advantage of the many utilities provided in the Unix system Write powerful shell scripts Use the shell’s built-in decision-making and looping constructs Use the shell’s powerful...
This book is for readers who are proficient at working with Linux and who want to learn about shell scripting to improve their efficiency and practical skills. The following are few examples where we ...
Pro Bash Programming teaches you how to effectively utilize the Bash shell in your programming. The Bash shell is a complete programming language, not merely a glue to combine external Linux commands....
Wicked Cool Shell Scripts,第二版的Shell脚本集合Wicked Cool Shell Scripts第二版的完整Shell脚本如何使用采购wcss_shell.sh脚本将设置您的bash环境,以便可以从PATH调用这些脚本,而不必相对或绝对地调用这些...