bash ignores escaped $ and says "bad substitution"
Can someone tell me how to get the version of bash that I am running?
I'm running cygwin bash on Windows XP at home and cygwin bash on Vista at work.
Is this the version number for bash?
$ uname -a
CYGWIN_NT-6.0 US-SEA-L3BER9K 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygwin
This is the version at work that does not work.
Here is the command that works at home but not at work:
Now who is complaining about the substitution: bash or groovy?
Why is bash complaining about a bad substitution? I escaped the "$" so bash would ignore it and this works at home. I tried "\\$" but that did not help! I want groovy to do the substitution, not bash.
The bash at work is a recent installation (August 2009). The bash at home was last updated a while ago, maybe spring 2009?
Hmmm... now that I am re-reading my own post I'm wondering if this is a groovy issue, not a bash issue. I'm trying to figure how how to delete this post...
Thanks,
Siegfried
Last edited by siegfried; 10-22-2009 at 04:14 PM..
You should be able to get the bash version by using
uname has nothing to do with the version of bash. It shows information about the kernel revision, etc.
I would say that groovy is the one complaining, because you've quoted the string, and escaped everything else, there is no reason why bash should complain.
I know it may seem odd, but I got a similar error having dumped a script from Red Hat to Vista, edited it and passed it back again; CR/LF issues with the SCP transfer.
If you 'cat -vet' the file on both systems, does the output look the same?
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)
I've found this script part on the stackoverflow:
if ; then
sudo bash "$0" "$@";
exit "$?";
fi
I realized that sudo bash "$0" "$@"; is the only needed for me.
But the strange thing happens when I move this line outside the IF statement:
sudo bash "$0" "$@"; stops the... (9 Replies)
Hi All,
I'm completely new to bash scripting and still learning my way through albeit vey slowly.
I need to know where to insert my server names', my ip address numbers through out the script alas to no avail.
I'm also searching on how to save .sh (bash shell) script properly.... (25 Replies)
Is there any way to get the escaped version of a field in awk? For those that don't understand the question, here is a clarifying example. Lets say a field $1 gives me the string "(dumb'" (I've changed the delimiter to be something other than whitespace). If i use that value in a command in awk... (2 Replies)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
Hello,
I'm brand new to Sun/Solaris.
I have a Sun Blade 150, with SunOS 5.8.
I wanted to make a backup to prevent future data loss, so I put the disk in a normal PC with Windows XP to try to make a backup with Norton Ghost, the disk was detected, but not the file volume, so I place the disk... (6 Replies)
Hallo,
i need a Prompting read in my script:
read -p "Enter your command: " command
But i always get this Error:
-p: is not an identifier
When I run these in c-shell i get this error
/usr/bin/read: read: bad option(s)
How can I use a Prompt in the read command? (9 Replies)
Hi,
What is the actual difference between these two? Why the following code works for process substitution and fails for command substitution?
while IFS= read -r line; do echo $line; done < <(cat file)executes successfully and display the contents of the file
But,
while IFS='\n' read -r... (3 Replies)
I tried rebooting my Sun server just a few minutes ago and I got the following at boot:
--
Sun Fire 280R (UltraSPARC-III+) , No Keyboard
Copyright 1998-2002 Sun Microsystems, Inc. All rights reserved.
OpenBoot 4.5, 1024 MB memory installed, Serial #xxxxxxxxx
Ethernet address... (6 Replies)