C shell 撲滅委員会at UNIXC shell 撲滅委員会 - 暇つぶし2ch■コピペモード□スレを通常表示□オプションモード□このスレッドのURL■項目テキスト331:名無しさん@お腹いっぱい。 08/06/17 10:59:44 #!/bin/csh -f set com=$0 if ($#argv < 1 || $#argv > 3) then echo Usage:$com start_line total_lines '[file_name]' exit 1 endif if ($#argv == 2) then set s=$1 set t=$2 tail +$s | head -$t else set s=$1 set t=$2 set f=$3 cat $f | tail +$s | head -$t endif exit 0 echo ------------------ これだとエラーがでます。どなたか改良してください。お願いします。 332:名無しさん@お腹いっぱい。 08/06/18 02:37:22 cshはglobの制御がどうにもしがたい。糞。 333:名無しさん@お腹いっぱい。 08/06/18 03:12:26 #!/bin/sh com="$0" if [ $# -lt 2 -o $# -gt 3 ]; then echo Usage:$com start_line total_lines '[file_name]' >&2 exit 1 fi if [ $# -eq 2 ]; then s="$1" t="$2" tail +$s | head -$t else s="$1" t="$2" f="$3" cat $f | tail +$s | head -$t fi exit 0 次ページ最新レス表示レスジャンプ類似スレ一覧スレッドの検索話題のニュースおまかせリストオプションしおりを挟むスレッドに書込スレッドの一覧暇つぶし2ch