iTerm2 つかいはじめた。Vim も練習中。
iTerm2 シンプルでいいなぁ。 シンプルでとてもいい。欲しい操作がついてる。 とてもいい。
Vim は、 Ctrl + C で抜けるのになれると、 もっとしあわせになれそうな気がする。
ファイル名に日時を指定する
echo > result-`date +%Y%m%d_%H%M%S`.log
find 調べ中1
man
を調べながら読んでいきます。
find コマンド
find コマンドは対象パスのディレクトリーツリーを再帰的に探索して、指定された処理を実行する。
書式
find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression] find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]
オプション
-E
-regex
と -iregex
オプションに続く正規表現を、基本正規表現(extended (modern) regular expressions)ではなく、拡張正規表現(basic regular expressions (BRE's))として解釈する。基本正規表現と拡張正規表現については、 re_format(7)
に解説がある。
今日はここまで。
英単語メモ
recursively 再帰的に
primaries プライマリー
operands オペラント
interpret 解釈する
builtin command 調べ中2
type command
たたいてみる。 shell は zsh。
type which which is a shell builtin type -a which which is a shell builtin which is /usr/bin/which
builtin command 調べ中
きっかけ
man cd
をたたいた。
BUILTIN(1) BSD General Commands Manual BUILTIN(1) NAME builtin, !, %, ., :, @, {, }, alias, alloc, bg, bind, bindkey, break, breaksw, builtins, case, cd, chdir, command, complete, continue, default, dirs, do, done, echo, echotc, elif, else, end, endif, endsw, esac, eval, exec, exit, export, false, fc, fg, filetest, fi, for, foreach, getopts, glob, goto, hash, hashstat, history, hup, if, jobid, jobs, kill, limit, local, log, login, logout, ls-F, nice, nohup, notify, onintr, popd, printenv, pushd, pwd, read, readonly, rehash, repeat, return, sched, set, setenv, settc, setty, setvar, shift, source, stop, suspend, switch, telltc, test, then, time, times, trap, true, type, ulimit, umask, unalias, uncomplete, unhash, unlimit, unset, unsetenv, until, wait, where, which, while -- shell built-in commands SYNOPSIS builtin [-options] [args ...] DESCRIPTION Shell builtin commands are commands that can be executed within the running shell's process. Note that, in the case of csh(1) builtin commands, the command is executed in a subshell if it occurs as any component of a pipeline except the last. :
cd
単独の説明がでると思っていたのにそうじゃなかった。
Shell builtin commands というのは、何か特別らしい。
まずは man を読んでみる。
DESCRIPTION Shell builtin commands are commands that can be executed within the running shell's process. Note that, in the case of csh(1) builtin commands, the command is executed in a subshell if it occurs as any component of a pipeline except the last. If a command specified to the shell contains a slash ``/'', the shell will not execute a builtin com- mand, even if the last component of the specified command matches the name of a builtin command. Thus, while specifying ``echo'' causes a builtin command to be executed under shells that support the echo builtin command, specifying ``/bin/echo'' or ``./echo'' does not. While some builtin commands may exist in more than one shell, their operation may be different under each shell which supports them. Below is a table which lists shell builtin commands, the standard shells that support them and whether they exist as standalone utilities. Only builtin commands for the csh(1) and sh(1) shells are listed here. Consult a shell's manual page for details on the operation of its builtin commands. Beware that the sh(1) manual page, at least, calls some of these commands ``built-in commands'' and some of them ``reserved words''. Users of other shells may need to consult an info(1) page or other sources of documentation. Commands marked ``No**'' under External do exist externally, but are implemented as scripts using a builtin command of the same name.
↓ jman
解説 シェル組み込みコマンドは、実行中のシェルプロセス内で実行されるコマンドです。 csh(1) 組み込みコマンドの 場合、パイプラインの構成要素として登場する場合には、最後の構成要素である場合を除き、コマンドはサブシェ ル内で実行されます。 シェルに対して指定されたコマンドがスラッシュ ``/'' を含む場合、指定したコマンドの最後の部分が組み込み コマンドの名前とマッチする場合でも、シェルは組み込みコマンドを実行しません。それ故、組み込み echo コマ ンドをサポートするシェルでは ``echo'' は組み込みコマンドを実行させますが、 ``/bin/echo'' や ``./echo'' は組み込みコマンドを実行させません。 複数のシェルに存在する組み込みコマンドもありますが、それらの動作はこれをサポートする各シェルで異なるか もしれません。下表は、シェル組み込みコマンドと、これらをサポートする標準シェルと、独立ユーティリティと して存在するか否かを列挙しています ここには csh(1) と sh(1) の組み込みコマンドだけを列挙しています。これらのシェルのもとでの各組み込みコ マンドの動作の詳細は、適切なマニュアルページを参照してください。他のシェルのユーザは、そのシェルと共に 提供される文書を参照する必要があるでしょう。
よくわからない。
ネットの記事を読む
この記事がわかりやすかった。 ビルトインコマンドのメモ | OpenGroove
シングルコマンドを複数行で記述する
困ったこと
echo $PATH | sed 's/:/ /g'
実行。エラー。
sed: 1: "s/:/ /g": unescaped newline inside substitute pattern
最終的に
echo $PATH | sed 's/:/\ /g'
バックスラッシュでコマンドをつないだ。
Linux Bash Script, Single Command But Multiple Lines? - Super User
最終的にここで答え?にたどり着いたのだけど shell のコマンドについてはいつもうまく調べられず、もやもやすることが多い。 行き当たりばったりで動かしている感覚。 答えが見つかってからあらためてキーワード指定しなおして調べなおしてももやもやが晴れない。
シェルプログラミング実用テクニック (Software Design plus)
を少しずつ読み進めようとおもうけど、少しはすっきりするといいなぁ。