請教shell script如何抓檔名 - Linux

Zora avatar
By Zora
at 2011-08-15T22:43

Table of Contents

請問各位大大:
我想使用shell script來讀檔,
但偏偏要讀的檔名不是固定的檔案名稱,
例如為dfa000XXXXXXXX(XXXXXXXX的部份是變數),
那我應該怎麼寫shell script來讀此檔呢?
謝謝。

--
Tags: Linux

All Comments

Mason avatar
By Mason
at 2011-08-20T18:44
dfa000* ?
David avatar
By David
at 2011-08-22T13:42
重點在你如何傳檔名給 sh
Rae avatar
By Rae
at 2011-08-26T03:11
an ultimate way is using "find -print0" and "xargs -0"
Edith avatar
By Edith
at 2011-08-26T23:31
or find -exec
Ophelia avatar
By Ophelia
at 2011-08-29T02:41
我簡單的用 files=`ls` 除掉不需要的東西 XD
Hedy avatar
By Hedy
at 2011-08-29T15:46
files=$(ls | grep 'dfa000.\{1,8\}') 我來亂的(逃)
不確定你是不是要這樣
Xanthe avatar
By Xanthe
at 2011-09-02T03:33
name=`basename 變數檔名`

可查詢記錄的print server

Olga avatar
By Olga
at 2011-08-15T14:38
請問一個企業環境 使用者為m$系統 有數十台不同廠商型號的網路印表機 都在同一個網段裡面 請問: 一、 suse是server主機,有沒有什麼套件可以達成 使用者使用網路印表機列印時會留下使用記錄 ...

關於NIS

Dinah avatar
By Dinah
at 2011-08-15T13:57
我不懂怎樣叫架設好NIS? 鳥哥的步驟全做了 感覺上是好了 可是我的client 是否應該 /home 裡面會有那些帳號呢? - ...

刪除包含某字串的整行

Eden avatar
By Eden
at 2011-08-15T12:29
如果某行包含 apple 我希望能刪去那一整行(而非變空白) 應該是用sed吧 可是我查到的刪除 都只有指定行號 請問可以指定and#39;包含字串and#39;嗎? - ...

用VM安裝完UBUNTU變醜???

Quanna avatar
By Quanna
at 2011-08-14T19:45
我用VirutalBox安裝ubuntu 之前安裝完都好好的 不過最近把他移除在安裝一次 發現安裝完 桌面上排選單列變很醜 都灰灰一塊一塊的 之前開終端機背景是黑的 現在開背景變白的 這是什麼關係? 我全部設定都沒動過 - ...

用cclive下載youtube

Emma avatar
By Emma
at 2011-08-14T17:51
跟據我man到的方法 最簡單的就是$cclive and#34;網址and#34; 然後我輸入 cclive and#34;http://www.youtube.com/watch?v=2X1nP8RJmvAandamp;feature=feedrec_grec_indexand#34; 結果得到以下 ...