ITeye博客

shell

共 5 篇文章

shell字符串截取

${string#substring} 从string左边去掉第一个substring ${string%substring} 从string右边去掉第一个substring

2013-07-19 15:09 · shell

一个命令创建多个目录

可能我太土了,才发现下面这个命令! mkdir -p src/{test,main}/{java,resources}

2013-06-13 12:36 · linux · shell

Date/Time处理函数总结 [To Do]

几种我所用到的用来处理日期,时间的函数总结。 Perl localtime # 0 1 2 3 4 5 6 7 8 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); If parameter is not provides, it will use current time. Note the $year returned contains the number of years since 1900, to get a 4-digit year you need: $year += 1900; …

2013-04-12 10:46 · java · perl · python · javascript · shell

xargs: How To Control and Use Command Line Arguments

am trying to use xargs command using shell pipes and not able to understand how to control and use command line arguments. For example I'd like to find out all *.c file located in 100s of sub-directories and move them to another directory called ~/old.src. How do I use command line args with xargs …

2009-08-13 09:59 · linux · shell

grep: writing output: Broken pipe

ls -t $FOLDER | grep "stat"| head -$fileNum 我的python脚本里面call了一个shell脚本,里面有这一行,执行的时候就会有标题这样的warning。原因查了一下,是说head执行完了就exit了,因此grep面对的是一个没有reader的pipe,就是broken pipe了。 不会有啥坏处,不管它也没事,或者把输出的warning重定向到/dev/null也可以。

2009-08-12 15:32 · linux · shell