Advertising

Author Topic: <SOLVED> Bashing executable sh as alias  (Read 270 times)

Offline simplio

  • Newbie
  • *
  • Posts: 13
<SOLVED> Bashing executable sh as alias
« on: August 11, 2019, 05:46:43 pm »
I wanted to just type in "op25" from home directory in terminal without having to cd all the time. I tried the instructions here https://www.hagensieker.com/wordpress/2018/07/17/op25-for-dummies/

Quote
In the comments below Mr. Alex Bowman found an easier way to launch the program.  Create an alias in Linux so that you just type “op25” (without the quotes) into the terminal from any directory.

sudo nano .bashrc

Then paste in the following lines.

#OP25 alias
alias op25=’bash /home/john/op25/op25.sh’

Be sure your path is right about.  Note my path of /home/john.  Yours is different unless your name is John, of course.

Now hit Ctl key plus X, then hit Y to save.  Restart the terminal and you should now be able to launch OP25 just by typing OP25.  It works like a champ.  I tried it.

That’s it.  I hope I made this easier for someone.


the correct directory for me is 'bash /home/ddejr/op25/op25/gr-op25_repeater/apps/op25.sh'
Did that and failed  ???

Quote
ddejr@ddejr-pc:~$ op25
bash: op25: command not found
ddejr@ddejr-pc:~$ sudo nano .bashrc
ddejr@ddejr-pc:~$ op25
bash: op25: command not found
ddejr@ddejr-pc:~$



« Last Edit: August 12, 2019, 08:30:33 am by simplio »

Offline lami07

  • Global Moderator
  • Full Member
  • *****
  • Posts: 105
    • Sparky Community Repos
Re: Bashing executable sh as alias
« Reply #1 on: August 11, 2019, 06:16:05 pm »
Instructions from the article are :
1) create little shell script called op25.sh with such content:

Code: [Select]
#! /bin/sh

cd /path/to/the/op25/op25/gr-op25_repeater/apps

./rx.py –args ‘rtl’ -N ‘LNA:47’ -S 2400000 -f 857.2625e6 -o 25000 -q -2 -T trunk.tsv -V -2 -U 2> stderr.2

2) make it executable

Code: [Select]
sudo chmod +x /path/to/the/op25.sh
3) create alias

Code: [Select]
sudo nano ~/.bashrc

Then paste in the following lines.

#OP25 alias
alias op25=’bash /path/to/the/op25.sh’
« Last Edit: August 11, 2019, 06:35:14 pm by lami07 »
Quote from: forum rules
When an issue has been resolved for you, please edit the original post to include <SOLVED> in the title. This provides a good indicator for users with a similar problem to check out the thread
Want to chat? Join #sparkylinux at irc.freenode.net

Offline kanliot

  • Jr. Member
  • **
  • Posts: 69
Re: Bashing executable sh as alias
« Reply #2 on: August 11, 2019, 07:32:38 pm »
did OP restart bash?

when the alias command has run- it should work.

check by listing the aliases!

(type alias) and look for it in alphabetical order.

Offline simplio

  • Newbie
  • *
  • Posts: 13
Re: <SOLVED> Bashing executable sh as alias
« Reply #3 on: August 12, 2019, 08:31:34 am »
I didn't know to exec bash. I did exec bash after editing it in bash, it worked. I did two entries into bash and didn't need to make one shell script executable. Thanks!  :)

« Last Edit: August 12, 2019, 09:46:03 am by simplio »