csatblogspotdotcom

Saturday, April 5, 2008

1st 3 bash scripts

#!/bin/bash
#list using a long listing format
#can't use * when there is a space in a filename
ls -l --color=auto $@
(or ls -l --color=auto $*)

#!/bin/bash
#list all files in a directory
#can't use * when there is a space in a filename
ls -a --color=auto $@
(or ls -a --color=auto $*)

#!/bin/bash
#mv files into ~/.Trash
#can't use * when there is a space in a filename
mv $@ ~/.Trash
(or mv $* ~/.Trash)


后记:
今天又用alias实现了前两个
后面一个在支持mv的-t选项的系统上也行

在 ~/.bash_profile 中加上
alias ll='ls -l'
alias la='ls -a'
而后面一个
alias trash='mv -t ~/.trash/'
但像FreeBSD这样的系统不支持-t选项,这我就没办法了

Labels: ,

1 Comments:

At November 26, 2008 at 3:58 AM , Anonymous Anonymous said...

今天又用alias实现了前两个
后面一个在支持mv的-t选项的系统上也行

在 ~/.bash_profile 中加上
alias ll='ls -l'
alias la='ls -a'
而后面一个
alias trash='mv -t ~/.trash/'
但像FreeBSD这样的系统不支持-t选项,这我就没办法了

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home