LoginSignup
0
0

More than 5 years have passed since last update.

Bash Tricks

Last updated at Posted at 2017-03-29

テンプレートが書かれたファイルを複数作成する

initial="
require 'test/unit'\n\n
def methodName\n\n
end\n\n
class TestClassName < Test::Unit::TestCase\n\n
\tdef TestMethodName\n\n
\tend\n\n
end
"

for ((i=1; i < 31; i++)); do
    echo -e $initial > test_$i.rb
done

このようなファイルが30個作成される

test_1.rb
require 'test/unit'

def methodName

end

class TestClassName < Test::Unit::TestCase

    def TestMethodName

    end

end

bash commandエイリアス作成

alias dcm='docker-compose'

.bashrc再読み込み

bash -l

bashプロンプト変更

# 一時的変更
export PS1="\[\e[3;34m\]\w/ \[\e[0m\]$ "

# bash起動時に反映させる
echo "export PS1='\[\e[3;34m\]\w/ \[\e[0m\]$ '" > ~/.bash_rc
echo "export PS1='\[\e[3;34m\]\w/ \[\e[0m\]$ '" > ~/.bash_profile
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