有關script的問題? - Linux

By Emily
at 2008-11-15T13:35
at 2008-11-15T13:35
Table of Contents
※ 引述《joedenkidd (優質的藍色射手)》之銘言:
: 各位版友好:
: 我寫了一個script如下
: #!/bin/sh
: for((i=1;i<=50;i++))
: {
: if[i<10] then
: touch tty0$i;
: else
: touch tty$i;
: fi;
: }
: 這個script是要建立50個檔案
: 內容是tty01~tty50
: 這個script最後也會產生50個檔案,
: 但是會說此檔案不存在,
: 不過最主要的問題是
: if~else的判斷似乎沒有用
: 它產生的檔案為tty1~tty50,
: 我寫的斷判式就沒有效果了!
: 請有經驗的版友給點意見吧!
#!/bin/bash
for(( i=1; i<=100; i=i+1 ))
do
if [ "$i" -lt 10 ]; then
/usr/bin/touch "tty0${i}";
else
/usr/bin/touch "tty${i}";
fi
done
這是我改好的
--
Appleboy Blog: http://blog.Wu-Boy.com
Appleboy Life: http://life.wu-boy.com
--
: 各位版友好:
: 我寫了一個script如下
: #!/bin/sh
: for((i=1;i<=50;i++))
: {
: if[i<10] then
: touch tty0$i;
: else
: touch tty$i;
: fi;
: }
: 這個script是要建立50個檔案
: 內容是tty01~tty50
: 這個script最後也會產生50個檔案,
: 但是會說此檔案不存在,
: 不過最主要的問題是
: if~else的判斷似乎沒有用
: 它產生的檔案為tty1~tty50,
: 我寫的斷判式就沒有效果了!
: 請有經驗的版友給點意見吧!
#!/bin/bash
for(( i=1; i<=100; i=i+1 ))
do
if [ "$i" -lt 10 ]; then
/usr/bin/touch "tty0${i}";
else
/usr/bin/touch "tty${i}";
fi
done
這是我改好的
--
Appleboy Blog: http://blog.Wu-Boy.com
Appleboy Life: http://life.wu-boy.com
--
Tags:
Linux
All Comments

By Harry
at 2008-11-20T13:19
at 2008-11-20T13:19

By Gilbert
at 2008-11-22T04:36
at 2008-11-22T04:36

By Hardy
at 2008-11-25T04:32
at 2008-11-25T04:32

By Caroline
at 2008-11-27T23:09
at 2008-11-27T23:09
Related Posts
ubuntu數據機撥接上網

By Sandy
at 2008-11-15T13:23
at 2008-11-15T13:23
suse10 開機無法進入圖形介面

By Eartha
at 2008-11-15T12:50
at 2008-11-15T12:50
Re: Email被雅虎拒收똿

By Oliver
at 2008-11-15T09:11
at 2008-11-15T09:11
emacs的複製和貼上

By Skylar Davis
at 2008-11-15T00:03
at 2008-11-15T00:03
關於更改權限的問題?

By Agnes
at 2008-11-14T22:21
at 2008-11-14T22:21