トップページunix
988コメント297KB

シェルスクリプト総合 その24©5ch.net

■ このスレッドは過去ログ倉庫に格納されています
0001名無しさん@お腹いっぱい。 転載ダメ©2ch.net2014/11/11(火) 00:54:03.43
シェルスクリプトの総合スレです。
□お約束
・特記なき場合はBourne Shell(/bin/sh)がデフォルトです。
 bash/zsh/ksh/ashなどに依存する場合は明示しましょう。
 Linuxユーザは/bin/shの正体がbashまたはdashなので特に注意。
 FreeBSDユーザは/bin/shの正体がashなので注意。
 v7 shに一番近くて、現役のshは、OpenSolaris由来のheirloom sh。
  http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/sh/
  http://heirloom.sourceforge.net/sh.html
・csh/tcshのシェルスクリプトは推奨されません。
 (理由は「csh-whynot」でググれ)
・UNIXにはシェルスクリプトに便利な小さなコマンドがいろいろあります。
 manや参考リンクを見ましょう。
 aproposないしはman -kでそれらしい単語による簡単な検索もできます。
・シェルで使えるワイルドカード等は正規表現ではありません。
 正規表現の話題はスレ違い(正規表現スレへ)
・シェルスクリプトのことをシェルってゆーな
□初心者へのアドバイス:
・適した道具を判断するのも頭の重要な使い方。シェルスクリプトよりも
 awkまたはperlの方が適した処理にはそちらを使いましょう。
・知らないコマンドが出てきたらmanを引きましょう。
・思い通りに動かないときは、まずは sh -x でトレースしましょう。
□回答者への注意事項:
・シェルスクリプトでの処理方法を質問しているのに、よくわからずに
 「そういうのはperl使いましょう」と回答するのはやめましょう。
 安易にperlに逃げずにシェルスクリプトで処理するのが頭のいいやり方。
前スレ
シェルスクリプト総合 その23
http://peace.2ch.net/test/read.cgi/unix/1404204950/
0191名無しさん@お腹いっぱい。2015/01/01(木) 18:19:12.95
GNUにはあった気がする
0192名無しさん@お腹いっぱい。2015/01/01(木) 18:26:54.79
引数ないときは「クリップボードから」なんて慣習は存在しない。
0193名無しさん@お腹いっぱい。2015/01/01(木) 18:29:20.31
興味があったのでちょっと検索してみた。
ガイドラインというのはわからないが、こんな感じで使われてるね〜みたいのなら、

http://catb.org/~esr/writings/taoup/html/ch10s05.html

> The -a to -z of Command-Line Options
>
> Over time, frequently-used options in well-known Unix programs have established a loose sort of semantic standard
> for what various flags might be expected to mean. The following is a list of options and meanings that should prove
> usefully unsurprising to an experienced Unix user:

http://www.gnu.org/prep/standards/html_node/Option-Table.html

> 4.9 Table of Long Options
>
> Here is a table of long options used by GNU programs. It is surely incomplete, but we aim to list all the options that
> a new program might want to be compatible with. If you use names not already in the table, please send
> bug-standards@gnu.org a list of them, with their meanings, so we can update the table.
■ このスレッドは過去ログ倉庫に格納されています