.bashrc别名帮助命令

时间:2018-08-09 19:03:28

标签: linux bash shell

我想为我的.bashrc别名创建一个自定义的帮助命令,这是我到目前为止所拥有的

到目前为止,这是我的自定义脚本

bashrc='/home/jordan/.bashrc'

alias=$(cat $bashrc | grep -o -P '(?<=alias ).*(?==)' | sed -e 's/ //g' | sed -e "s/ls='ls--color//g")
desc=$(cat $bashrc | grep -o -P '(?=#Custom).*' | sed -e 's/#Custom //g')

这是我的.bashrc别名

alias ci3='code ~/.config/i3/config && exit' #Custom Open i3 config in VS Code
alias cpoly='code ~/.config/polybar/config && exit' #Custom Open i3 Config in VS Code
alias cdpoly='code ~/.config/polybar/launch.sh && exit' #Custom Open Polybar Config in VS Code
alias cds='cd ~/.config/scripts' #Custom cd into the scripts directery
alias cdc='cd ~/.config' #Custom cd into ~/.config
alias cbash='code ~/.bashrc' #Custom open .bashrc in VS Code
alias vg='cd ~/voxelgame' #Custom cd into voxel game directory
alias sb='source ~/.bashrc && echo ".bashrc compiled"' #Custom Compile .bashrc
alias update-addons='sudo python3 $HOME/Documents/wow-addon-updater/WoWAddonUpdater.py' #Custom update elvui
alias cdd='cd ~/Documents' #Custom cd into Documents
alias school='cd ~/Documents/School' #Custom cd into School directory
alias cs105='cd ~/Documents/CS105' #Custom cd into CS105 directory
alias cs140='cd ~/Documents/CS140' #Custom cd into CS140 directory
alias math137='cd ~/Documents/MATH137' #Custom cd into MATH137 directory
alias cs105t='evince ~/Documents/School/CS105/Big-Java-Early-Objects.pdf &' #Custom Open CS105 Textbook in Evince(PDF Viewer)
alias math137t='evince ~/Documents/School/MATH137/Precalculus-OP.pdf &' #Custom Open MATH137 Textbook in Evince(PDF Viewer)

编辑:我希望该命令是一种自定义帮助页面,其中列出了命令及其作用。

1 个答案:

答案 0 :(得分:1)

alias xyz='echo "hi"; #does things'
alias

将输出

alias xyz='echo "hi"; #does things'

xyz

将运行命令并输出

hi

您必须更改别名以包含注释,但这不会影响其输出。这够吗?