PuppyLinux : shell

PuppyLinuxMainPage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register

shell


ash or bash in Puppy (others exist, such as Korn and C shells)
See also: ShellScripts

sh is the default shell, which in 1.0.5 and 1.0.6 is ash or bash
(In 1.0.6, SHELL seems to point to bash, but the command line seems to nevertheless default to ash.)

ash is the simplified BusyBox version of bash (BusyBox v0.60.5 in 1.0.6)

Bash, an acronym for "Bourne−Again Shell" and a pun on Stephen Bourne's now classic
Bourne Shell. Bash has become a de facto standard for shell scripting on all flavors of UNIX.
The bash is GNU bash 3.00.0(1) in 1.0.6.

http://www.unixguide.net/linux/linuxshortcuts.shtml -- Shell Shortcuts

http://www.gnu.org/software/bash/bash.html
http://www.tldp.org/LDP/abs/abs-guide.pdf
Advanced Bash−Scripting Guide. An in−depth exploration of the art of shell scripting.

SSH or Secure Shell allows you to remotely login to and work on your system.
http://wiki.linuxquestions.org/wiki/Using_SSH
http://wiki.linuxquestions.org/wiki/SSH

Complete list of command line tools:
http://wiki.linuxquestions.org/wiki/Commands

http://www.linuxdevcenter.com/linux/cmd/
Alphabetical Directory of Linux Commands
Click on any of the 687 commands below to get a description and list of available options.

(The BusyBox lash LAme SHell has not been included in standard Puppy, at least up to 107alpha.)

= = = = = =
1.0.5 has SHELL="/bin/bash" in /etc/profile

you can change that to SHELL=/bin/sh or SHELL=/bin/ash

ash is busybox's shell
sh is bash running under the name sh
bash is bash running under the name bash

ash and sh will execute the file named in ENV everytime they start ... you can setup environment variables there, and aliases, and set the prompt

bash does not use ENV ... it executes /root/.bashrc ... you can setup the environment for bash in there, including the prompt

ash and sh use /etc/profile if they are started as a login shell ... bash uses /root/.bash_profile (or maybe it's .bash-profile) if it's started as a login shell

also, bash and ash have a slightly different syntax for setting the prompt

you can see what's happening if you put echo commands in the rc files, something like echo '/root/.bashrc is executing'

you can change SHELL=/bin/bash in /etc/profile to SHELL=/bin/sh or to SHELL=/bin/ash ... or you can setup ENV and .bashrc files to work the way you want

= = = = = =
In Puppy 1.0.6, the console seems to always start in bash. You can switch to ash by just giving the command
# ash
You can then switch back to bash by just giving the command
# bash
But if you are a newbie it is confusing to be able to tell what is going on. (ash sort of tells you it is taking control, but bash is silent, just giving a # prompt.) If you are in ash and close the command line window, or start another one, you always start in bash. The prompts look exactly the same.

You can tell which one is active by entering the command
# help
If you get a short busybox list of commands, you are using ash.
If you get a long page of legacy Linux commands, you are using bash.

Also, you can use the command
# echo $RANDOM
If you get a blank response, you are using ash.
If you get a random number typed in response, you are using bash.

Another way to tell the difference is with the up and down cursor keys. These give access to a buffer of previous command lines. ash and bash have seperate buffers. ash always starts with an empty buffer. bash retains a large history of your commands from previous sessions.

= = = = = =
one way to tell if you are in bash or ash is by typing help ... you can switch to ash by typing ash and you can switch to bash by typing bash

one way you could test whether a script is being executed by ash or bash would be something like this
Code:
if echo $RANDOM | grep [0-9] > /dev/null
then
echo 'running bash'
else
echo 'running ash'
fi

i don't know if there's a more official way to do it

if SHELL=/bin/bash then terminal emultors like rxvt, aterm, mrxvt, xterm will open a command line window using bash as the shell

if you run a script, it should be run using the program that the first line tells it to use ... you can run a script using bash by typing bash my-script or using ash by typing ash myscript

bash is in /usr whuich is normally not available until usr_cram.fs is mounted, and will not be available after usr_cram.fs is unmounted when Puppy shuts down ... if bash were in /bin, bash would have to be in image.gz and it would make image.gz bigger ... the larger image.gz is, the more ram Puppy requires to boot

it is possible to change /bin/sh to symlink to /usr/bin/bash, so that /bin/sh executes bash instead of Busybox ... you have to be careful to do this properly, or you can cause Puppy to crash ... if you do this, you must symlink /bin/sh to busybox again before Puppy shuts down, or Puppy will crash when usr_cram.fs is unmounted

if you have installed Puppy to the hard drive ... option 2 ... then you don't have the problem of usr_cram.fs mounting and unmounting ... bash is always available

Busybox's ash does not behave exactly the same as bash, so it is possible that some programs might not work properly if they are run with a different shell


http://www.murga.org/%7Epuppy/viewtopic.php?t=4305
ash/bash shells: which does Puppy use?

http://www.pupweb.org/puppy/puppy-startup.htm
Good tech discussion of the startup of ash and bash during Puppy boot.


external links:
http://www.wlug.org.nz/Shell
http://www.wlug.org.nz/ash(1)
http://linux.about.com/library/cmd/blcmdl1_ash.htm
http://www.debian.org/doc/manuals/reference/ch-program.en.html
http://www.phenix.bnl.gov/WWW/offline/tutorials/debuggingTips.html

http://bashdb.sourceforge.net/
BASH with Debugger and Improved Debug Support and Error Handling

http://www.neosoft.com/neosoft/man/bash.1.html

http://www.faqs.org/faqs/unix-faq/shell/bash/
[gnu.bash.bug] BASH Frequently-Asked Questions (FAQ version 3.26)

http://www.shelldorado.com/
Heiner's SHELLdorado
SHELLdorado - your UNIX shell scripting resource

http://www.softpanorama.org/Scripting/shells.shtml
Shellorama
(A Slightly Skeptical View on Shell Scripting)

CategoryDocumentation

There are 2 comments on this page. [Display comments]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.0
Page was generated in 0.0436 seconds