📜 ⬆️ ⬇️

Functions in bashrc. One more simple thing

In .bashrc you can describe functions.

Why am I doing this? If you are missing alias, it is not necessary to write a single-line script.

You can add a function in .bashrc, for example, to get an external ip address

wanip() {
wget -q -O - checkip.dyndns.com | awk '{print $6}'| sed 's/<.*>//'
}

In the command line, wanip will show your external ip address.
')
And it is better to put it in a separate file, for this add in .bashrc

if [ -f ~/.bash_func ]; then
. ~/.bash_func
fi

.bash_func - the name of the file, where we will write functions.

Source: https://habr.com/ru/post/121136/


All Articles