Last active
June 5, 2022 05:51
-
-
Save underground0930/de0eb0cc509de16984df19eccd98d490 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
######################################## | |
# 現在のカレントディレクトリに移動するためのaliasをセットする | |
# 例) | |
# 現在地 /Users/hogehoge/project_a/develop | |
# ターミナルで右のコマンドを実行 ⇨ set_alias hogehoge | |
# 以下のスクリプトが、指定したファイルの末尾に追加される | |
# alias hogehoge='cd /Users/hogehoge/project_a/develop' | |
# hogehoge とターミナルで実行すると、そのディレクトリに移動している | |
######################################## | |
# エイリアスに指定したい名前(他と被らないようにする) | |
name=$1 | |
# 保存先は、bashや、zshで読み込めればどこでも良いです | |
save_file=~/.zsh.d/alias.zsh | |
if [ -z "$name" ]; then | |
echo "please input alias name!" | |
exit; | |
fi | |
echo "alias $1='cd $(pwd)'" >> $save_file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment