0

In my bashrc i want to add an alias which would run a shell script.

I am trying the below :-

export termlist=/usr/data/log
export runterm=cd $termlist; bash termlist.sh

termlist.sh is the shell present in /usr/data/log directory. I want to just type runterm in the terminal and it should go to this directory and run the shell script. but its giving error as :

 bash termlist.sh : command not found
Aviator
  • 141

1 Answers1

1

How to create an alias is documented elsewhere.

The proper way to handle your situation is using a wrapper script instead.

Include your commands in a little bash script ~/.local/bin/runterm, with the contents:

termlist=/usr/data/log
cd $termlist
$termlist/termlist.sh

Once the script is set executable, you will be able to execute it by simply running runterm at the terminal.

Instead of ~/.local/bin, use /usr/local/bin if you want the executable to be available for all users of the system.

vanadium
  • 88,010