write down a command-line to see the help text that matches each argument
はじめに bash の初期化ファイル ログインシェルとは インタラクティブ(対話的)シェルとは ログインシェルとインタラクティブシェルの分類 各種環境における初期化ファイル CentOSの初期化ファイル Ubuntuの初期化ファイル macOS(Catalina以前)の初期化ファイル macOS(Catalina)の初期化ファイル 各環境におけるデフォルトの初期化ファイル 単一ファイル管理(~/.bashrc) 標準的管理(環境変数は~/.bash_profile) 厳格管理(~/.profile 利用) macOS Catalina の場合 まとめ はじめに 本記事では bash の初期化ファイルと、それにまつわる運用方法について説明します。 シェル(bash)の初期化ファイルには .profile .bashrc, .bash_profile などがありますが、どこに何を定義すべきかに
Hi, I looked into the installer and translated into bash one line by one. Needs some more works (not sure how to compare version string.. maybe I'll implement this with arrays parameter substitution works). I love Homebrew, thank you all. Why? resolves Port installer to Bash #217 Future versions of macOS won’t include scripting language runtimes by default, and might require you to install additio
今までbashのTab補完にはどうやって色付けすれば良いのだろうと思っていました。 lsした時に色付けするのは--color=autoのaliasを ~/.bashrc に書いていればOKですが、cd [Tab] でカレントディレクトリの補完をしようとした時には色付けされません。 これはどうやら ~/.inputrc で set colored-stats on とする事で設定できるみたい。 .inputrcはreadlineの設定ファイルなので、他にも色々と設定しておくと幸せになれそうです。 設定可能な項目を見ていると、以下のように設定すると便利そう。 # 補完時に大文字小文字を無視 set completion-ignore-case on # ファイルタイプをカラフルに set colored-stats on # 補完の接頭辞をカラフルに set colored-completio
Readline は GNU プロジェクトによって開発されているライブラリで、コマンドラインで編集したり対話するために Bash などの CLI インターフェイスプログラムで使われています。詳しくは readline(3) を参照してください。ここでは簡単な設定だけに触れます。 インストール readline パッケージは、Bash の依存関係としてすでにインストールされている可能性があります。 編集モード デフォルトでは Readline はコマンドラインと対話するのに Emacs のようなショートカットを使います。ただし、vi スタイルの編集インターフェイスもサポートはされています。 vi あるいは vim を使っている場合、以下の行を ~/.inputrc に記述することで Readline ベースのアプリケーションで vi ライクなキーバインドを有効にできます: ~/.inputr
3.5 Shell Expansions Expansion is performed on the command line after it has been split into tokens. There are seven kinds of expansion performed: brace expansion tilde expansion parameter and variable expansion command substitution arithmetic expansion word splitting filename expansion The order of expansions is: brace expansion; tilde expansion, parameter and variable expansion, arithmetic expan
3.5.3 Shell Parameter Expansion The ‘$’ character introduces parameter expansion, command substitution, or arithmetic expansion. The parameter name or symbol to be expanded may be enclosed in braces, which are optional but serve to protect the variable to be expanded from characters immediately following it which could be interpreted as part of the name. When braces are used, the matching ending b
3.5.2 Tilde Expansion If a word begins with an unquoted tilde character (‘~’), all of the characters up to the first unquoted slash (or all characters, if there is no unquoted slash) are considered a tilde-prefix. If none of the characters in the tilde-prefix are quoted, the characters in the tilde-prefix following the tilde are treated as a possible login name. If this login name is the null stri
※この記事は、zsh Advent Calendar 2014 - Qiitaの19日目です。 zsh無しにbashで生きる zsh大好きな皆さんは、bashを心の中のどこかでバカにしているのではないでしょうか。しかし最近のbashは、いろいろとzshを意識している(?)雰囲気があり、zsh特有だと思っていた機能が実はbashでも使えたりします。 そのため、 zshを使えないと全身から血を吹き出して死ぬ ログインシェルとしてzshが起動されないと発狂して死ぬ 「最近はSolarisにだってzshが入っている」と一日100回は唱えないと死ぬ zsh神社が欲しい、参拝したい という人でも、bashがあれば多少の延命ができるかもしれません。本稿では、zshが無いというサバイバル環境下において、bashでなんとかすることをテーマにいくつかサンプルを挙げてみます。 なおここでは、bashのプロンプト
bash の似たものシリーズ 初心者が躓きそうなbash で似て紛らわしいものの違いをはっきりさせようとさせるシリーズ。 bash に於ける xargs / for には違いがあるのか? あります。結構大きな違いが有ります。 それぞれのループの回しかたを復習しておきましょう。 for ループでコマンド結果を回す for e in some_command ; echo $e; done xargs パイプでコマンド結果を回す some_command | xargs -I @ echo @; この2つの、コマンドの実行には違いが在るのでしょうか。またコマンドの実行の速度には違いが出るでしょうか? 2つの違い xargsはサブシェルを起動するので変数の名前空間が違う コマンドの終了を待つfor と 終了を待たない xargs こんかいは、この後者の違いについて着目したいと思います。 毎秒カウ
上記の表の通り,Exit Code 1, 2, 126〜165, 255 は特別な意味を持ち,スクリプトやプログラム内で exit に指定するパラメータとしては避けるべきである.とりわけ,Exit Code 127 はトラブルシューティングで混乱の元である("command not found" で終了したのか,プログラム固有のエラーなのか区別できなくなる).しかしながら,多くのスクリプトが exit 1 を一般的な実行を続行できないエラーとして使っている.Exit Code 1 は Bash の一般的なエラーを含め,とても多くのエラーで発生しうるので,デバッグの時に切り分けが大変になるだろう. Exit Code を体系立てて定義する試みはある(/usr/include/sysexits.h)が,これは C と C++ プログラマー向けである.スクリプトに関しても同様な感じにするのが適切
Update & 注意 (2017.5.9) 最初の投稿からかなりの時間が経過しましたが、いくつか修正点が見つかりましたので、それぞれ訂正の注記を入れておきました。また、ポイントのまとめを表に改めました。 以下の記述は次の環境で動作確認しています。 OS X 10.11.6, Homebrew よりインストールされた Bash 4.4.12 Ubuntu 14.04.5 LTS, Bash 4.3.11(1)-RELEASE macOS 10.12.4, OSデフォルトの GNU bash, version 3.2.57(1)-release ログインシェルとして Bash が使用されていることを確認するには、echo $SHELL として環境変数 $SHELLに bash の実行ファイルが指定されていることを確認します。(2018.5.16追記: Ubuntu等、左記の方法では確かめられ
GPLv3: free as in freedom documented on the ShellCheck Wiki available on GitHub (as is this website) already packaged for your distro or package manager supported as an integrated linter in major editors available in CodeClimate, Codacy and CodeFactor to auto-check your GitHub repo written in Haskell, if you're into that sort of thing.
はじめに 以前書いたエントリー、重大な脆弱性(CVE-2017-5932)で少し話題になったbash4.4の補完機能の便利な点で、bash4.4からでないとタブの補完機能のソート処理が制御できないという問題について、ソースコードレベルで調べた結果をまとめていたのですが、bashの実装そのものを深く掘り下げ過ぎてしまい、内容が膨大になったので、何回かに分けて書こうと思います。 今回はbashが起動されてからインタラクティブモードでキーボードの入力を待ち受けるまでのお話です。普段使っているbashがどのような処理を行っているのか一緒に覗いてみませんか? 検証ソースコード Bash version 4.1.0(1) release GNU bashの生誕 bashのプロセスが起動されるのはOSへのログイン時にユーザーのログインシェルがbashに設定されている場合、あるいはログイン後に明示的にba
アプリの開発をしていると、アプリが吐き出すのログを見ることが多いと思います。 以前会社の同僚に教えてもらったので、自分で考えをまとめるために記事にします。 背景 僕の場合Railsで開発することが多く、development.logなどを見ることが多いです。 ログを垂れ流して見る場合ターミナルで tailf コマンドや tail -f を使っていて、 必要があれば Ctrl-c で止めてターミナルをスクロールしてログを見ていました。 あとはターミナルの検索機能で文字列検索したり。。。などなど そんな人に tail ではなく less を使うとちょっと便利だよという内容です。 lessの基本 Unix関連のOSには多分デフォルトでインストールされていると思います。 コマンドの引数にファイル名を指定して起動します。 操作感は more や vi と似ています。 vi とは違い起動時にファイルの
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く