csh(tcsh)
来源:互联网 发布:java 调用浏览器 编辑:程序博客网 时间:2024/04/30 05:59
1. TC Shell Initialize
/etc/csh.cshrc /etc/csh.login
.cshrc
2. Prompt
# The primary prompt set prompt = "$LOGNAME > "# The secondary prompt?3. Variable# local variableset name = "Tom"# global variablesetenv ORACLE_SID ora11g# read a line of inputset name = $<4. argumentsecho $1 $2 $3echo $*echo $argv[1] $argv[2] $argv[3]echo $argv[*]echo $#argv # the number of arguments5. arithmetic@ num = 4 + 6@ num++
6. Manipulating Stack Directory
pushd: Push DIR to directory-stack, and cd to DIR
popd: Pop DIR from directory-stack, and cd to DIR
dirs -v: Display the numbered directory stack.
7. Redirect
command > file # stdoutcommand >& file # stdout & stderrcommand | command # stdoutcommand |& command # stdout & stderrcommand >! file # override noclobber effectsls -l > ls.txtset noclobberls -l > ls.txt # ls.txt: File exists.ls -l >! ls.txt
8. Test variable whether is set
echo $?variable # 0(false, not set), 1(true)
9. Arrays
set fruit = ( apples pears peaches plums )echo $fruit # apples pears peaches plumsecho ${fruit[1]} # applesecho $fruit[2-4] # pears peaches plumsecho $fruit[*] # apples pears peaches plumsecho $#fruit # 4echo $fruit[$#fruit] # plumsset fruit[2] = bananasecho $fruit # apples bananas peaches plumsshift fruitecho $fruit # bananas peaches plums
10. Special Variables
$?var Return 1 if variable has been set, 0 if not$#var Print the number of elements in an array$$ Print the PID of current shell$< Accept a line of input user up to newline. set name = $<
11. Modifier
Modifier
Meaning
Example
Result
:r
Root
echo
/home/ellie/prog
:t
Tail
echo
c
:g
Global
echo $p:gt
set pv = /home/ellie/prog/check.c
echo pv:r # /home/ellie/prog/check
echopv:h # /home/ellie/prog
echo pv:t # check.c
echopv:e # c
set pv = (/home/*)
echo $pv:gt
**12. Quoting**
Single-Quate: except history(bang) character(!)
Double-Quate: expect history(bang) character(!) and the dollar sign($)
:q is used to replace the double quates
set name = “Daniel Savage”
grep
:x prevents the shell from expanding wildcards
set things = “*.pl a.??? my[1-5]”
echo things # check.pl a.txt
echo “things” # *.pl a.??? my[1-5]
set newthings = (
set newthings1 = (
history -T
**13. Completion**
To complete the command name, filename, variable name automatically.
set autolist
To ignore certain filename extensions while filename completion is in use.
set fignore = ( .o .gif )
Tab completion will ignore case
set complete = enhance
ls -l /bin/GAWK => /bin/gawk
Types of completion
p: postion-dependent p/1/: postion 1, the first argument
complete cd ‘p/1/d/’
set hosts = (10.137.5.95 10.186.22.150)
complete telnet ‘p/1/$hosts/’
telnet
10.137.5.95 10.186.22.150
**14. sched, a built-in command, to create a list of jobs that will be scheduled to run at some specific time.**
sched 16:00 echo ‘Time to start your lecture!’
**15. Case modifiers**:u Uppercase the first letter of a word:l Lowercase the first letter of a word:a Apply a modifier to an entire word
set name = ‘nicky’
echoname:uNickyecho name:au
NICKY
set names = (‘nicky’ ‘mike’)
echonames:uNickymikeecho names:gu
Nicky Mike
echo $names:gau
NICKY MIKE
**16. TC SHELL built-ins**builtins**17. Prevent the .cshrc or .tcshrc file from being read into your script, -f(fast)**\#!/bin/csh -f**18. setuid script**\#!/bin/csh -feb-f fast start up, don't execute .cshrc-e abort immediately if interrupted-b this is a setuid script
chmod 4755 myscrit
**19. control statement**
if ( -e file ) then
endif
while (
@ a = $a - 1
end
foreach color (red blue green)
echo $color
end
“`
- csh(tcsh)
- csh和tcsh
- csh(tcsh)编程一
- 配置你的 csh/tcsh
- 配置你的 csh/tcsh
- Linux + Shell bash / sh / ksh / csh / tcsh
- Linux + Shell bash / sh / ksh / csh / tcsh
- bash csh/tcsh 环境变量的设置
- FreeBSD 下 CSH(TCSH) 用户配置文件的运行顺序
- sh,bash,csh,tcsh等shell的区别
- Shell: sh,bash,csh,tcsh等shell的区别
- Shell: sh,bash,csh,tcsh等shell的区别
- sh,bash,csh,tcsh等shell的区别
- sh/bash/csh/Tcsh/ksh/pdksh等shell本质区别
- Linux:sh,bash,csh,tcsh等shell的区别
- sh/bash/csh/Tcsh/ksh/pdksh等shell本质区别
- sh/bash/csh/Tcsh/ksh/pdksh等shell的区别
- 几种常见的Shell:sh、bash、csh、tcsh、ash
- 图示aidl原理
- Debian下交换ctrl与esc键映射
- requests的content与text导致lxml的解析问题
- 工具类:拉伸一张图片(UIImage分类)
- Spring源码之ApplicationContext(七)获取消息资源
- csh(tcsh)
- The project target (Android N (Preview)) was not properly loaded.
- leetcode:Find Median from Data Stream
- NYOJ-214-单调递增子序列(二)
- Spring源码之ApplicationContext(八)消息广播
- Introduction: What is Spring Security?
- Codeforces 400C Inna and Huge Candy Matrix 【模拟】
- android的常用布局LinearLayout和RelativeLayout
- 汉诺塔III