LoginSignup
0
0

More than 5 years have passed since last update.

bash > x!2594 > historyからコマンド履歴を取得する (一部を変更して実行するため)

Last updated at Posted at 2017-12-23
動作環境
GeForce GTX 1070 (8GB)
ASRock Z170M Pro4S [Intel Z170chipset]
Ubuntu 16.04 LTS desktop amd64
TensorFlow v1.2.1
cuDNN v5.1 for Linux
CUDA v8.0
Python 3.5.2
IPython 6.0.0 -- An enhanced Interactive Python.
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
scipy v0.19.1
geopandas v0.3.0
MATLAB R2017b (Home Edition)
ADDA v.1.3b6

概要

$history
...
...
 2594  ../adda -orient avg CODE_171216_Euler/avg_params_beta_4_6_gamme_3_5.dat -shape chebyshev 0.7 12 -size 10
 2595  ../adda -orient avg CODE_171216_Euler/avg_params_beta_4_6_gamma_4_6.dat -shape chebyshev 0.7 12 -size 10
...

上記のようなコマンド履歴があるとする。
2594で実行したコマンドを別ファイルで実行したい。

手順

  • x!2594を実行
    • ここでは実行されない (失敗する)
  • カーソル上キー入力
    • 2594のコマンドになる
    • ただし最初に「x」が付いているので取り除いて使う
      • Ctrl+Aで行頭に移動、を使って取り除く
    • あとは変更したい部分を変更して使う

「x」の部分は「#」と「!」以外の文字列であれば有効だと思われる。

$ x!2594
x../adda -orient avg CODE_171216_Euler/avg_params_beta_4_6_gamme_3_5.dat -shape chebyshev 0.7 12 -size 10
-bash: x../adda: そのようなファイルやディレクトリはありません

マウスでコマンド履歴をcopy, pasteするよりは早い。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0