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?
Can You Upgrade Bash In Puppy Linux 5.4.3?
Sure (PPM). While an example error would've helped, you probably want coreutils. Check if it's installed..
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.
...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.
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..
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.
Saying you run frugal, I suppose you could <IF you really needed to> upgrade..
Code: Select all
GNU bash, version 4.2.24(1)-release-(i686-pc-linux-gnu)
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.
Indeed: ,, (convert to lowercase) is Bash 4 specific. To make it compatibile with Bash 3, you can use, for instance: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.
Code: Select all
if [ "`echo ${word} | tr [:upper:] [:lower:]`" = "please" ]
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]
[b][color=green]Omnia mea mecum porto.[/color][/b]