I've not come across this before, so on a scrap server, I ran it from the command line. I just got the following output:-
Your VAR='.... command will simply assign the literal text as shown to the variable VAR
Can you give us a bit more context as to where it was seen. If there is a small and complete bit of code that does something, could you share it? That would give us more to work on.
It's not { ;;};, it's { :;};, and it has been shown/used to demonstrate the shell shock vulnerability. The entire variable assignment above contains an (empty; or better: do nothing) function definition, followed by a command THAT IS NOT MEANT TO RUN but is executed by bash due to its vulnerability.
Over the years I have seen this syntax several times, in a case like this it is down to the user to chose the appropriate text.
As an example, a piece of testing code we use. The code is used to attempt to grab all the process table resource on a virtual system.
The code,
Is the routine definition, followed by what the code actually does in the braces. In this case, run a process - pass the output to the process and put it in the background.
Followed by the commad it's self.
Could just as easilly be written as,
We use the above as a test to ensure that solaris zones are correctly configures, this is one of several routines used to ensure that the zone has a correctly configured process table and that it won't impact the performance of a global zone.
I am sharing a code snippet.
for (( i=0; i<=$(( $count -1 )); i++ ))
do
first=${barr2}
search=${barr1}
echo $first
echo "loop begins"
for (( j=0; j<=5000; j++ ))
do
if } == $search ]]; then
echo $j
break;
fi
done
second=${harr2}
echo $second (2 Replies)
Hello! i try to understand the art of bash scripting but unfortunately, more i try and less i understand it.
Can someone tell me how i can learn its logic? i will give you an example why its making me crazy. Look at this basic script:
my for loops are working like this, but it took me more than... (10 Replies)
In the bash function below if the user selets "y" then the menu function is called and if they select "n" the move function is called. That all seems to work, my question is after the files are moved an echo,
line in bold is displayed and another function called backup is called. I am getting a... (1 Reply)
The below bash function uses multiple variables CODING, SAMPLE, SURVEY, andvariant
in it. The user selects the cap function and details are displayed on the screen using the $SURVEY variable, the directory is changed to $SAMPLE and the samples.txt is opened so the user can select the sample to... (6 Replies)
ec2addtag --region us-west-1 vol1234 --tag Name=$nameinst;
It should execute
ec2addtag --region us-west-1 vol1234 --tag Name=webserver;
Instead it thinks that Name is equal to that variable. Please help. Thanks!
Please use code tags! (0 Replies)
Hello.
In the following :
RESTORE_FF contain a file name : a_file.tar.gz
I am testing in a directory if "a_file.tar.gz" exists and or if any file like "a_file.tar.gz" exists.
So "a_file.tar.gz" will give me file exists
So "a_file.tar.gz." will give me file exists
So... (5 Replies)
I have a script that's meant to check the disk usage on a particular volume and delete the oldest logfile if it's over a certain percentage. It runs fine on a Linux machine, but on a Solaris one, I get this error:
diskspace_check.sh: syntax error at line 3: `diskspace=$' unexpected
I assume... (2 Replies)
I'm trying to write a simple script that takes all the .tar.gz files in a directory and verifies them by using the gzip -tv command:
for zip in *.tar.gz
do
gzip -tv $zip
if ; then #Check return code from tar
echo "File ${zip} verified OK."
exit... (4 Replies)