开发者

May I define aliases elsewhere than into .bashrc?

开发者 https://www.devze.com 2022-12-25 21:53 出处:网络
We are several persons using the same login id on Linux Box. I want to define my own aliases without interfering with anyone.

We are several persons using the same login id on Linux Box.

I want to define my own aliases without interfering with anyone.

In the .bashrc, I define a alias to my bash file defining my own aliases.

alias luc=/full/path/to/my/def_alias_luc开发者_如何学运维.sh

The file /full/path/to/my/def_alias_luc.sh contains

#!/bin/bash
echo ""
echo "Defining Luc's aliases"
echo ""

echo ""
echo "aliases before..."
echo ""
alias
alias vimluc="vim -u /full/path/to/my/.vimrc "
echo ""
echo "aliases after"
echo ""
alias

After executing /full/path/to/my/def_alias_luc.sh, the alias is still undefined.

What do I miss ?


Don't you want to source that file (i.e. run it within the existing bash process) rather than spawn off a new bash process (as the first line of the script would suggest you're doing) ?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号