Friday, December 19, 2014

How to use bash function defined in .bashrc file into bash script

First define function in .bashrc and then export it
d2h(){
  echo "obase=16; $@"|bc
}
export -f d2h
Above function converts decimal to hex and then export it, so that it can be used from other bash scripts

No comments:

Post a Comment