WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: using bash instead of sh - export in .X.d does not do the trick?  (Read 4862 times)

Offline bitpusher

  • Newbie
  • *
  • Posts: 33
using bash instead of sh - export in .X.d does not do the trick?
« on: December 16, 2013, 11:16:37 AM »
Because of sh's inability to count characters correctly when unicode is involved I want to use bash instead.
I found some tips on the net - e.g. here: http://yeti.selfip.net/cms/index.php/post/2013/06/21/UTF-8-everywhere-in-TinyCore-Linux to export the SHELL symbol from
/home/tc/.X.d/.
Thus I created a file sh in /home/tc/.X.d/ containing
export SHELL=/usr/local/bin/bash (I hope I understood the whole process correctly, and yes the file is set excutable)

However after re-booting there is still /bin/sh used in all xwindows terminals and echo=$SHELL gives /bin/sh

When I enter export SHELL=/usr/local/bin/bash in a xwindows terminal it works, bash is used - but only for this terminal of course.

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: using bash instead of sh - export in .X.d does not do the trick?
« Reply #1 on: December 16, 2013, 11:35:27 AM »
Parents cannot inherit the environment of their children.
Your shell is defined in /etc/passwd.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: using bash instead of sh - export in .X.d does not do the trick?
« Reply #2 on: December 16, 2013, 04:34:45 PM »
Your shell is defined in /etc/passwd.
That, plus you may want to append it to /etc/shells.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline bitpusher

  • Newbie
  • *
  • Posts: 33
Re: using bash instead of sh - export in .X.d does not do the trick?
« Reply #3 on: December 17, 2013, 08:43:10 AM »
So this means I have to change the shell in /etc/passwd with the result that I am left without a shell if for what ever reason the bash-extension is not loaded at boot?
And the idea of of putting the export command in /home/tc/.X.d/ (as suggested - in order to avoid having no shell if bash is not loaded - in the blog entry I linked) will/can not work at all?

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: using bash instead of sh - export in .X.d does not do the trick?
« Reply #4 on: December 17, 2013, 02:57:24 PM »
Well, what did you find when you tried it?

Add a line to bootlocal.sh that edits /etc/passwd if bash is loaded.
« Last Edit: December 17, 2013, 02:59:55 PM by gerald_clark »

Offline bitpusher

  • Newbie
  • *
  • Posts: 33
Re: using bash instead of sh - export in .X.d does not do the trick?
« Reply #5 on: December 31, 2013, 06:04:11 AM »
Sorry for late answer, but somehow Christmas came up - unsuspectedly, as every year.

Well, what did you find when you tried it?

OK, so when I put a file named sh containing

export SHELL=/usr/local/bin/bash

in  /home/tc/.X.d/ and re-boot tiny then obviously sh is still being used.

When I enter the export command directly:

tc@box:~$ export SHELL=/usr/Local/bin/bash
tc@box:~$ echo $SHELL
/usr/Local/bin/bash


and start another terminal window from there then the new terminal is actually using bash

So I think I understand the inheritance-thing now.

On the other hand I don't understand why having the script in /home/tc/.X.d/ was claimed to work in the article I linked.

Quote
Add a line to bootlocal.sh that edits /etc/passwd if bash is loaded.

I think I found an easier (to me) way to get what I want without changing /etc/passwd at all.

I had a symbolic link named aterm in ./home/tc/.local/bin pointing to /usr/local/bin/urxvt anyway (to use urxvt instead of aterm as standard terminal).

Now I replaced this link with a script file just containing SHELL=/bin/bash urxvt.
(Didn't know that making a new termianl use a certain shell was that easy - I told you I'm kind of new to Linux)

Of course now I have a different problem as the DEL key is not working (at leas not the way I am used for about 30Years - it just gives me a ~).
And I can't find a /.inputrc anywhere...

Edit:

Figured it out, put my own .inputrc in /home/tc containing:

set editing-mode emacs
"\e[3~":delete-char
"\e[1~": beginning-of-line
"\e[4~": end-of-line
# kvt
"\e[H":beginning-of-line
"\e[F":end-of-line
# rxvt and konsole (i.e. the KDE-app...)
"\e[7~":beginning-of-line
"\e[8~":end-of-line

« Last Edit: December 31, 2013, 09:17:04 AM by bitpusher »

Offline bitpusher

  • Newbie
  • *
  • Posts: 33
Re: using bash instead of sh - export in .X.d does not do the trick?
« Reply #6 on: January 06, 2014, 06:36:23 AM »
Update: (Just in case somebody else tries this, thought I'd share the info)

While the process described above gave me bash in an urxvt when clicking on the "aterm" wbar-icon the apps-tool was not really happy with bash in an urxvt disguised as aterm: When trying to install anything from the cloud a new terminal popped up, but nothing else ever happened...

Therefore I renamed the aterm script file in  ./home/tc/.local/bin to bashurxvt (not to confuse any other programs anymore) and did the following to make my first extension!

cd /tmp
sudo mkdir -p bashurxvt/usr/local/share/applications/
cd bashurxvt


Created a file bashurxvt.desktop in usr/local/share/applications/ containing:

[Desktop Entry]
Name=Terminal
Exec=bashurxvt
Type=Application
X-FullPathIcon=/usr/local/share/pixmaps/aterm.png
Icon=aterm
OnlyShowIn=Old;
Categories=System;


Then I did:
mksquashfs . ../bashurxvt.tcz
to put it together as an extension, installed the new extension and have the urxvt with bash on the wbar now!

Offline TinyFun

  • Newbie
  • *
  • Posts: 33
Re: using bash instead of sh - export in .X.d does not do the trick?
« Reply #7 on: January 19, 2014, 03:21:57 PM »
maybe a little late...and inly have simple solution to your original reason to want bash:
Try :
"VAR=HJHKSJHSDKJHSAKJHASKJHDAJSHJSKJDASA"
"echo -n $VAR | wc -m"

This will count chars.
« Last Edit: January 19, 2014, 03:24:31 PM by TinyFun »

Offline TinyFun

  • Newbie
  • *
  • Posts: 33
Re: using bash instead of sh - export in .X.d does not do the trick?
« Reply #8 on: January 20, 2014, 05:03:39 AM »
Sorry, too late to edit previous post. please disregard

will try to read and think before posting