Scripting In BASH and Using the Command Line

Using applications, configuring, problems
Post Reply
Message
Author
User avatar
Blackfish
Posts: 324
Joined: Wed 26 Feb 2014, 15:36
Location: Brookings, SD

Scripting In BASH and Using the Command Line

#1 Post by Blackfish »

I am not having any trouble using the command line, and I use it to do a lot of things. I am not as adept as I should be for having been a Linux user for well over a year now, but let's just say I get the gist of it, but at the same time I would like to learn more.

On scripting, I haven't done any of that. From what I have read so far, near as I can tell, Puppy uses the ASH shell, which is different than other, more popular shells. I don't know much about the various shells... So, the way I understand this is that I would want to start to learn writing scripts in ASH because I am a hopeless Quirky and Puppy user (I say, "hopeless" because I try new distros all the time but always come back to Quirky).

Quirky comes with Geany and Leafpad, which should be fine for scripting, I think. Anything else I would need?

Can someone point me in the right direction to get this work started? Your help would be much appreciated.

[Update 21 July 2015: Puppy and Quirky use BASH shell -- my mistake!]
Last edited by Blackfish on Tue 21 Jul 2015, 02:17, edited 1 time in total.
Dell Latitude E5500 w/ Intel Centrino processor-- running bionicpup64-8.0

ebisu
Posts: 176
Joined: Wed 25 Sep 2013, 05:06

#2 Post by ebisu »

Last edited by ebisu on Mon 01 Aug 2016, 08:30, edited 1 time in total.

slavvo67
Posts: 1610
Joined: Sat 13 Oct 2012, 02:07
Location: The other Mr. 305

#3 Post by slavvo67 »

Puppy has Ash and Bash. There is a thread somewhere in here that explains how much faster Ash is if you're not doing complex scripts.

Not sure how to default ash from the terminal, though.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#4 Post by musher0 »

Hello, BlackFish.

For everybody's information, the default script interpreter in Puppy is
bash. Ash is available in Puppy because it is part of the busybox kit, but
ash is not the default script interpreter in Puppy.

There is not much difference between bash and ash: ash is sometimes
twice as fast as bash but ash is more limited than bash. Also the syntax
for functions is different between the two and I believe that you cannot
process arrays in ash. (Someone please correct me if I am wrong.)

I'd suggest that you start scripting in bash. Once you've come up with
some result, if you need speed, try running your script with
#!/bin/ash instead of #!/bin/sh in the "crunchbang" line
(Linux lingo for the top line of every script).

If your script doesn't work with ash, don't worry about it, it will still run
in bash, right?

It's like swimming. You won't know how until you pinch your nose and
you jump in the water! :)

BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Blackfish
Posts: 324
Joined: Wed 26 Feb 2014, 15:36
Location: Brookings, SD

#5 Post by Blackfish »

I'm using Quirky and it is /bin/bash. My mistake. I found the way to check it and got it right. I will update the thread.

I get really confused, especially in the beginning, because I was running Ubuntu and started learning the command line from it. Then went to Puppy, then to Quirky, and many of the commands I learned with Ubuntu don't work in Puppy or Quirky. It's not the same. And many of the tutorials I find on the Web don't work, even though they are BASH shell. Often they are working from MINT or Ubuntu, and when I try to follow the instructions in Quirky, not all of it works. Perhaps it is easier and better to learn BASH and scripting from Ubuntu or MINT? I don't know.

Another trick I found is to open a terminal and press control + tab + tab. This lists (allegedly) all the commands. But having all the commands at one's fingertips doesn't explain everything. It certainly doesn't tell how to start writing scripts.
Dell Latitude E5500 w/ Intel Centrino processor-- running bionicpup64-8.0

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#6 Post by musher0 »

Hello, blackfish.

Stop whining :roll: and start practicing with any one of these! :lol:

http://www.ask.com/web?qsrc=1&o=0&l=dir ... archTopBox

Get to work, man, get to work.

Best of luck.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Blackfish
Posts: 324
Joined: Wed 26 Feb 2014, 15:36
Location: Brookings, SD

#7 Post by Blackfish »

OK, thanks!
Dell Latitude E5500 w/ Intel Centrino processor-- running bionicpup64-8.0

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#8 Post by Lobster »

Ah @Blackfish

here is how to run your first bash program with Puppy
http://youtu.be/PXP1IiCjdE0


The reason some ubuntu programs may not run is because bash calls other programs which ubuntu may have and Puppy may not ...

more programming and bash in Puppy School
http://www.puppylinux.org/wikka/PuppySchoolProgramming
Last edited by Lobster on Tue 21 Jul 2015, 14:08, edited 1 time in total.
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

step
Posts: 1349
Joined: Fri 04 May 2012, 11:20

#9 Post by step »

musher0 wrote:There is not much difference between bash and ash
There is significant difference, IMO. To stay on the safe side, regard ash as almost a subset of bash, bash as almost a superset of ash, and do google for "bashism".

Finding complete documentation about ash is not so easy. There are many versions and implementations of ash, which differ from each other in subtle ways.

If you write an ash script and want to make sure it works also in bash my suggestion is to test the script thoroughly in bash.

It might also pay off to google for "POSIX shell".
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]

User avatar
Blackfish
Posts: 324
Joined: Wed 26 Feb 2014, 15:36
Location: Brookings, SD

#10 Post by Blackfish »

Lobster wrote:Ah @Blackfish

here is how to run your first bash program with Puppy
http://youtu.be/PXP1IiCjdE0


The reason some ubuntu programs may not run is because bash calls other programs which ubuntu may have and Puppy may not ...

more programming and bash in Puppy School
http://www.puppylinux.org/wikka/PuppySchoolProgramming
Got it. Nice lesson and good reading. Thank you.
Dell Latitude E5500 w/ Intel Centrino processor-- running bionicpup64-8.0

User avatar
Hotdog
Posts: 134
Joined: Fri 30 Sep 2011, 03:15
Location: Georgia USA

#11 Post by Hotdog »

Blackfish,

The CLI commands in Puppy are a subset of the full Linux command set. Our commands are provided by BusyBox. The web site for busybox is http://www.busybox.net and there is a good description of the commands and their options at http://www.busybox.net/downloads/BusyBox.html Note that some commands do not carry a full implementation of options. I have not found any impediment to anything that I have tried to do while using BusyBox
[i]Puppy 5.2.8.7, Full Install[/i]

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#12 Post by musher0 »

Hotdog wrote:Blackfish,

(...) I have not found any impediment to anything that I have tried to do while using BusyBox
As for me, I've found the stripped-down functions of busybox increasingly
frustrating, but this is a free world: Hotdog is entitled to his opinions!

BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Blackfish
Posts: 324
Joined: Wed 26 Feb 2014, 15:36
Location: Brookings, SD

#13 Post by Blackfish »

Thanks Hotdog and musher0, I will look into it. Now, I'm starting to get somewhere!
Dell Latitude E5500 w/ Intel Centrino processor-- running bionicpup64-8.0

User avatar
Blackfish
Posts: 324
Joined: Wed 26 Feb 2014, 15:36
Location: Brookings, SD

#14 Post by Blackfish »

I find that in learning BusyBox, many of the commands do nothing, appear to do nothing, or the command is not found, etc. I attribute this to being a quirk of Quirky. How accurate am I on that score? And if my thinking is accurate, what is the best Puppy Linux flavor for use in learning BusyBox better? Anything but Quirky?
Dell Latitude E5500 w/ Intel Centrino processor-- running bionicpup64-8.0

Post Reply