Jump to content


Photo

OpenPLi 8.0 and bash profile


  • Please log in to reply
18 replies to this topic

#1 Burroughs70

  • Member
  • 21 posts

0
Neutral

Posted 9 February 2021 - 12:31

Good morning everyone and thanks for accepting me in the forum.
I've just installed OpenPLi 8.0 on my Zgemma H7S and, as I use many bash scripts for different reasons during the day, I'd like to take advantage of aliases, just to make my work a little bit easier.
I've copied the same bash_profile I've been using for years on openATV, but, when I launch one of the aliases, I receive the following message:
 

-sh: alias_name: command not found

I suspect it's something related to environment variables and path, so, well... is there a way to fix it???
Thank you very much...


Edited by Burroughs70, 9 February 2021 - 12:31.


Re: OpenPLi 8.0 and bash profile #2 catastrofus

  • Senior Member
  • 3,490 posts

+44
Good

Posted 9 February 2021 - 12:57

Install bash, something like: opkg install bash


2 x vu+ultimo4k ((nb & 9.0r) dvb-c fbc + 1 dvb-s2) + een vu+duo4k ((nb) fallbackclient) met een Synology ds214+ (2 x 6 TB) op DSM 7.1.1 in ziggo oost (voormalig @Home) + A1/A2/A3/HB (TechniSat)
 


Re: OpenPLi 8.0 and bash profile #3 Burroughs70

  • Member
  • 21 posts

0
Neutral

Posted 9 February 2021 - 14:09

Install bash, something like: opkg install bash

Thank you, buddy, but bash has already been installed.



Re: OpenPLi 8.0 and bash profile #4 catastrofus

  • Senior Member
  • 3,490 posts

+44
Good

Posted 9 February 2021 - 14:31

Edit /etc/passwd (vipw) and make bash the default shell or start your script(s) with #!/bin/bash


2 x vu+ultimo4k ((nb & 9.0r) dvb-c fbc + 1 dvb-s2) + een vu+duo4k ((nb) fallbackclient) met een Synology ds214+ (2 x 6 TB) op DSM 7.1.1 in ziggo oost (voormalig @Home) + A1/A2/A3/HB (TechniSat)
 


Re: OpenPLi 8.0 and bash profile #5 WanWizard

  • PLi® Core member
  • 71,236 posts

+1,842
Excellent

Posted 9 February 2021 - 14:53

Not needed, when you install bash, sh will become an alias to bash.

 

The error here is correct, "alias_name" is not a bash command. So either that profile has something wrong in it, or is missing something.


Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Ultimate (S2+T2), Octagon SF8008 (S2+T2), Zgemma H9.2H (S2+T2)

Due to my bad health, I will not be very active at times and may be slow to respond. I will not read the forum or PM on a regular basis.

Many answers to your question can be found in our new and improved wiki.


Re: OpenPLi 8.0 and bash profile #6 Burroughs70

  • Member
  • 21 posts

0
Neutral

Posted 9 February 2021 - 14:57

Here's an extract from .bash_profile:

export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$PATH

alias e2='ls -la /media/usb/backrest_folder/e2-*.tar.gz'
alias md='cd /media/hdd/movie'
alias my='/usr/sbin/myip'
alias tr='rm /media/hdd/movie/.Trash/*'
alias vpn_up='/etc/init.d/openvpn start'
alias vpn_down='/etc/init.d/openvpn stop'

 



Re: OpenPLi 8.0 and bash profile #7 WanWizard

  • PLi® Core member
  • 71,236 posts

+1,842
Excellent

Posted 9 February 2021 - 15:00

That doesn't list the command "alias_name" ?

 

These all work fine:

root@vuduo4k:~# bash
root@vuduo4k:~# alias e2='ls -la /media/usb/backrest_folder/e2-*.tar.gz'
root@vuduo4k:~# alias md='cd /media/hdd/movie'
root@vuduo4k:~# alias my='/usr/sbin/myip'
root@vuduo4k:~# alias tr='rm /media/hdd/movie/.Trash/*'
root@vuduo4k:~# alias vpn_up='/etc/init.d/openvpn start'
root@vuduo4k:~# alias vpn_down='/etc/init.d/openvpn stop'

root@vuduo4k:~# alias
alias e2='ls -la /media/usb/backrest_folder/e2-*.tar.gz'
alias md='cd /media/hdd/movie'
alias my='/usr/sbin/myip'
alias tr='rm /media/hdd/movie/.Trash/*'
alias vpn_down='/etc/init.d/openvpn stop'
alias vpn_up='/etc/init.d/openvpn start'

Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Ultimate (S2+T2), Octagon SF8008 (S2+T2), Zgemma H9.2H (S2+T2)

Due to my bad health, I will not be very active at times and may be slow to respond. I will not read the forum or PM on a regular basis.

Many answers to your question can be found in our new and improved wiki.


Re: OpenPLi 8.0 and bash profile #8 Burroughs70

  • Member
  • 21 posts

0
Neutral

Posted 9 February 2021 - 15:10

Mmm, probably I didn't explain the right way: each one of the commands works properly, the aliases are not working at all.
Here's an example:
 

root@satty:~# my
bash: my: command not found

 



Re: OpenPLi 8.0 and bash profile #9 WanWizard

  • PLi® Core member
  • 71,236 posts

+1,842
Excellent

Posted 9 February 2021 - 15:17

Not a problem either:

root@vuduo4k:~# bash
root@vuduo4k:~# alias my='/usr/sbin/myip'
root@vuduo4k:~# my
bash: /usr/sbin/myip: No such file or directory

so its probably that your profile isn't sourced at all.

 

what exactly have you created where?
 


Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Ultimate (S2+T2), Octagon SF8008 (S2+T2), Zgemma H9.2H (S2+T2)

Due to my bad health, I will not be very active at times and may be slow to respond. I will not read the forum or PM on a regular basis.

Many answers to your question can be found in our new and improved wiki.


Re: OpenPLi 8.0 and bash profile #10 mrvica

  • Senior Member
  • 1,283 posts

+90
Good

Posted 9 February 2021 - 15:21

I put them always in /etc/profile and they work, i.e

export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM

alias ll='ls -al'
alias dir='ls -al'
alias del='rm'
alias copy='cp'
alias memfree='cat /proc/meminfo | grep MemFree'

umask 022



Re: OpenPLi 8.0 and bash profile #11 Burroughs70

  • Member
  • 21 posts

0
Neutral

Posted 9 February 2021 - 15:23

Of course, all the ones I've mentioned before are scripts, not something created by the system.
Just to give you an example:

root@satty:~# which myip
/usr/sbin/myip

The alias doesn't work.



Re: OpenPLi 8.0 and bash profile #12 WanWizard

  • PLi® Core member
  • 71,236 posts

+1,842
Excellent

Posted 9 February 2021 - 15:25

I meant the file your aliases are in. They aren't sourced.


Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Ultimate (S2+T2), Octagon SF8008 (S2+T2), Zgemma H9.2H (S2+T2)

Due to my bad health, I will not be very active at times and may be slow to respond. I will not read the forum or PM on a regular basis.

Many answers to your question can be found in our new and improved wiki.


Re: OpenPLi 8.0 and bash profile #13 Burroughs70

  • Member
  • 21 posts

0
Neutral

Posted 9 February 2021 - 15:28

I've solved the problem, it was all about telling OpenPLi to use bash as the default shell.
In /etc/passwd I corrected the following way:
 

root:x:0:0:root:/home/root:/bin/bash

Thank you all for your precious help... ;)
 



Re: OpenPLi 8.0 and bash profile #14 catastrofus

  • Senior Member
  • 3,490 posts

+44
Good

Posted 9 February 2021 - 18:50

@WanWizard: Why these strange softlinks?

 

root@panoramix:/bin# ls -l sh
lrwxrwxrwx    1 root     root            14 Dec 30 20:01 sh -> /bin/bash.bash
root@panoramix:/bin# ls -l bash*
lrwxrwxrwx    1 root     root            14 Dec 30 20:01 bash -> /bin/bash.bash
-rwxr-xr-x    1 root     root        797688 Dec 24 22:22 bash.bash
root@panoramix:/bin#


bash links to bash.bash?

 

 

 

 

 

Not needed, when you install bash, sh will become an alias to bash.

 

The error here is correct, "alias_name" is not a bash command. So either that profile has something wrong in it, or is missing something.

 


2 x vu+ultimo4k ((nb & 9.0r) dvb-c fbc + 1 dvb-s2) + een vu+duo4k ((nb) fallbackclient) met een Synology ds214+ (2 x 6 TB) op DSM 7.1.1 in ziggo oost (voormalig @Home) + A1/A2/A3/HB (TechniSat)
 


Re: OpenPLi 8.0 and bash profile #15 WanWizard

  • PLi® Core member
  • 71,236 posts

+1,842
Excellent

Posted 9 February 2021 - 20:11

This is the way busybox and update-alternatives deal with multiple shells. You can't compare OE directly with desktop distro's, which don't have all space optimisations OE has...


Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Ultimate (S2+T2), Octagon SF8008 (S2+T2), Zgemma H9.2H (S2+T2)

Due to my bad health, I will not be very active at times and may be slow to respond. I will not read the forum or PM on a regular basis.

Many answers to your question can be found in our new and improved wiki.


Re: OpenPLi 8.0 and bash profile #16 catastrofus

  • Senior Member
  • 3,490 posts

+44
Good

Posted 9 February 2021 - 20:35

Huh? Bash isn't a part of busybox?


2 x vu+ultimo4k ((nb & 9.0r) dvb-c fbc + 1 dvb-s2) + een vu+duo4k ((nb) fallbackclient) met een Synology ds214+ (2 x 6 TB) op DSM 7.1.1 in ziggo oost (voormalig @Home) + A1/A2/A3/HB (TechniSat)
 


Re: OpenPLi 8.0 and bash profile #17 WanWizard

  • PLi® Core member
  • 71,236 posts

+1,842
Excellent

Posted 9 February 2021 - 21:06

No. Bash is Bash.

 

What I meant was that on a desktop distro you have a default shell, you can install other shells, and you have to manually change your shelll as a user, this is normal on multiuser *nix.

 

OE is made for embedded systems, where you don't have multiple users (normally), and you don't have end-users. There is also no concept of per-user security.

 

So you have /bin/sh as shell for root, and update-alternatives is used to replace sh with bash using symlinks, when you install that. It's the way Debian seems to do it.


Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Ultimate (S2+T2), Octagon SF8008 (S2+T2), Zgemma H9.2H (S2+T2)

Due to my bad health, I will not be very active at times and may be slow to respond. I will not read the forum or PM on a regular basis.

Many answers to your question can be found in our new and improved wiki.


Re: OpenPLi 8.0 and bash profile #18 catastrofus

  • Senior Member
  • 3,490 posts

+44
Good

Posted 9 February 2021 - 21:24

Apparently not for Burroughs70. If bash is the default shell in 8.0r he didn't have to adjust his default shell in /etc/passwd to make his scripts run. :wacko:


2 x vu+ultimo4k ((nb & 9.0r) dvb-c fbc + 1 dvb-s2) + een vu+duo4k ((nb) fallbackclient) met een Synology ds214+ (2 x 6 TB) op DSM 7.1.1 in ziggo oost (voormalig @Home) + A1/A2/A3/HB (TechniSat)
 


Re: OpenPLi 8.0 and bash profile #19 WanWizard

  • PLi® Core member
  • 71,236 posts

+1,842
Excellent

Posted 9 February 2021 - 23:41

Bash isn't the default shell in any OE environment, ash is (/bin/sh), which is a busybox built-in. So you'll start out with a symlink from sh to busybox.

 

When you install bash, update-alternatives will replace the symlink with one to bash. And it calls the binary "bash.bash" because "bash" itself is also a symlink (which could link to a diffferent binary).

 

You don't need to update /etc/password, as after installation /etc/sh -> /bin/bash.bash. So it will start bash automatically.

 

As I wrote before, this is not what you want on a normal *nix system as it would replace the shell for all users. So there it works differently.

 

I've double checked my box here, I haven't changed anything, just installed bash, and both /etc/profile and ~/.profile are called upon login.


Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Ultimate (S2+T2), Octagon SF8008 (S2+T2), Zgemma H9.2H (S2+T2)

Due to my bad health, I will not be very active at times and may be slow to respond. I will not read the forum or PM on a regular basis.

Many answers to your question can be found in our new and improved wiki.



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users