這是我的作業練習之一。shell腳本幫助
Write a shell program, which will take a directory as an argument. The script should then print all the regular files in the directory and all the recursive directories, with the following information n the given order for each of the files File name (full name from the specified directory) file size owner In case the directory argument is not given, the script should assume the directory to be the current working directory
我對如何解決這個問題感到困惑。對於文件列表部分,我嘗試了
ls -R | awk ...,但我無法做到這一點,因爲我無法爲awk找到合適的字段分隔符。 我知道它不公平的要求解決方案,但請你們能給我一個提示,告訴我如何解決這個問題?提前致謝。
你的意思exec命令? – CHID
沒有--exec該--printf選項查找(GNU發現4.1.20,可能還有其他人)給你你需要的一切。 –
謝謝,這是有益的 – CHID