source bash_func - Programming On Unix

Users browsing this thread: 1 Guest(s)
budRich
Long time nixers
Less is more, here are some very simple functions that I always source in to my .bashrc

Code:
# prints newest file in dir
function lat() { ls -t | head -1 ;}

# example:
$ cd Downloads/EducationalVideos
$ mpv `lat`

Code:
# adds an alias and re-sources .bashrc
# not perfect improvements are very welcome
adda(){
  al=$1
  shift 1
  echo "alias $al='${@}'" >> $HOME/.bash/alias
  . $HOME/.bashrc
}

# example:
$ adda lolello echo hello | toilet | lolcat

# adds: alias lolello='echo hello | toilet | lolcat' - to ~/.bash/alias

I also use some of the nuggets from this thread on another forum:
https://linuxbbq.org/bbs/viewtopic.php?f=4&t=2076


Messages In This Thread
source bash_func - by budRich - 16-11-2017, 07:38 AM
RE: source bash_func - by venam - 16-11-2017, 08:04 AM
RE: source bash_func - by zge - 16-11-2017, 07:15 PM
RE: source bash_func - by venam - 17-11-2017, 01:19 AM