2011年5月21日のブックマーク (3件)

  • Expectの使い方 - (・∀・)イイ!!Memo

    例 expect&ssh † sshで接続して、lsを実行。 #!/usr/bin/expect set timeout 5 spawn ssh somehost.example.com expect "password:" send "YOUR PASSWD\r" expect "Last login" send "ls\r" interact ↑ 例. expect&sendmail † sendmailをexpectで叩いてメール送信。テスト送信を何回もやるとき便利。 #!/usr/bin/expect set timeout 5 spawn telnet somehost.example.com 25 expect "somehost.example.com" send "helo somehost.example.com\n" expect "pleased to meet yo

  • bashの便利な機能を使いこなそう(2/2)

    bashのカスタマイズ bashは、組み込みの「シェル変数」を使ってその動作をある程度変更できます。シェル変数の設定方法は、 のように、変数名に数値あるいは文字列を代入する形になります。 組み込み変数にどんなものがあるか、ざっと見てみましょう。 ヒストリ関係 ●HISTCMD 現在のコマンドのヒストリ番号。 ●HISTCONTROL ignorespace:スペースやタブで始まる行をヒストリに記録しない ignoredups:入力が最後のヒストリと一致する場合に記録しない ignoreboth:ignorespaceとignoredups両方を指定 指定なし:すべての入力をヒストリに記録する ●HISTFILE ヒストリファイル名。 例:HISTFILE=/home/username/.bash_history ●HISTFILESIZE ヒストリファイルに格納するヒストリの最大数。 ●H

    bashの便利な機能を使いこなそう(2/2)
    rikkeydesu
    rikkeydesu 2011/05/21
    bash関連ファイルの読み込み関係
  • .bash_profileと.bashrcの違いは

    ユーザーのホームディレクトリには、.bash_profileや.bashrcといったファイルがある。どんなファイルがあるかは、-aオプション付きでlsコマンドを実行すると表示される。 $ ls -a ./          .bash_history  .bashrc  .emacs           .rpmmacros  rpm/ ../         .bash_logout   .canna   .emacs-color.el  .screenrc   tmp/ .Xdefaults  .bash_profile  .cshrc   .emacs.el        .xemacs.el この中の.bash_profileと.bashrcは、共にログインしたときに実行される設定用のシェルスクリプトだが、両者にはもちろん違いがある。 .bash_profileは、ログイン時だけに

    rikkeydesu
    rikkeydesu 2011/05/21
    意外と分かってない部分