| Author |
Message |
Gnuxo
Joined: 09 Feb 2012 Posts: 360
|
Posted: Thu 28 Feb 2013, 19:52 Post subject:
Can You Upgrade Bash In Puppy Linux 5.4.3? |
|
I've been trying to learn some Bash, and practicing if and then statements by writing a few newbie scripts but I keep getting syntax errors on almost everything I try.
I did a version check on Bash and found out that it's version 3.00 and that might explain why it's not responding to some of my bash commands.
Can Bash be updated? Or is there a workaround?
|
|
Back to top
|
|
 |
Semme
Joined: 07 Aug 2011 Posts: 2035 Location: World_Hub
|
Posted: Thu 28 Feb 2013, 20:06 Post subject:
|
|
Sure (PPM). While an example error would've helped, you probably want coreutils. Check if it's installed..
|
|
Back to top
|
|
 |
Gnuxo
Joined: 09 Feb 2012 Posts: 360
|
Posted: Fri 01 Mar 2013, 01:46 Post subject:
|
|
Coreutils is actually installed.
...and the example isn't very long. Just a little joke bash script I tried writing.
#!/bin/bash
clear
echo 'Say Please'
read word
clear
if [ ${word,,} = "please" ]
then
echo 'Thank you.'
fi
In that instance, line 7 ${word,,} comes up as a bad substitution error.
I couldn't understand why. And then I guessed that maybe the version of Bash is too old.
|
|
Back to top
|
|
 |
Semme
Joined: 07 Aug 2011 Posts: 2035 Location: World_Hub
|
Posted: Fri 01 Mar 2013, 09:42 Post subject:
|
|
I doubt the bash version's your problem. It's understanding, and you need help.
Saying you run frugal, I suppose you could <IF you really needed to> upgrade..
| Code: | | GNU bash, version 4.2.24(1)-release-(i686-pc-linux-gnu) |
Page search *read* for examples >> http://tldp.org/LDP/abs/html/
As far as coreutils, you have a version of it.
If GNU was installed, you'd be able to: which unlink and find it.
Send Flash a pm- have'm move this thread to Programming.
|
|
Back to top
|
|
 |
SFR

Joined: 26 Oct 2011 Posts: 570
|
Posted: Fri 01 Mar 2013, 10:57 Post subject:
|
|
| Gnuxo wrote: | In that instance, line 7 ${word,,} comes up as a bad substitution error.
I couldn't understand why. And then I guessed that maybe the version of Bash is too old. |
Indeed: ,, (convert to lowercase) is Bash 4 specific. To make it compatibile with Bash 3, you can use, for instance:
| Code: | | if [ "`echo ${word} | tr [:upper:] [:lower:]`" = "please" ] |
Greetings!
_________________ [O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
|
|
Back to top
|
|
 |
Semme
Joined: 07 Aug 2011 Posts: 2035 Location: World_Hub
|
Posted: Fri 01 Mar 2013, 11:00 Post subject:
|
|
Ah.. WHO I was hoping would post! Me? I'd never have guessed..
|
|
Back to top
|
|
 |
Gnuxo
Joined: 09 Feb 2012 Posts: 360
|
Posted: Fri 01 Mar 2013, 21:19 Post subject:
|
|
I'm still getting strange errors.
Does puppy even come with tr? I heard that some stripped down systems don't come with it.
edit: Nevermind. It works. Thank you very much for the help.
|
|
Back to top
|
|
 |
|