Hello, first off, let me begin by saying that I am a complete GNU/linux noob. I installed it on my laptop not even a month ago, because I've gotten tired of Windows on my laptop, but anyway. I'm starting to write bash shell scripts, and one of my friends who found out that I was starting this and never had any luck with shell scripts said that their memcache is always full after running a virtual machine, or just leaving it active for a while. So I figured that the best way to solve this would be to write a script (because there's no simple pre-existing command to do this that I've found on the internet), my problem is that every time I try to run it, I get the following error:
I already know that the cache dumping mechanism in the code works, because I've tested it in its own separate script. I've also tested the switching mechanism. the following is the entire script, as well as a comment where the issue is, so that you don't need to count.
For those of you who noticed, it can also take arguments, however, every time I've tried to invoke them, the same error occurs, at the same line. Any help would be greatly appreciated, thank you!
Last edited by Puddles187; 04-09-2011 at 11:23 PM..
Reason: page spacing, grammatical errors.
Well, skimming your code, those \n sequences are probably not what you intend. They'll just add an 'n'.
Also, you can't use (to my knowledge, which is limited on bash) "&&" and "||" boolean operators within a test command ([.....]).
should be written as
or perhaps better still as
Regards,
Alister
After replacing some &&s with -a, the terminal said that that invoked another syntax error around the areas that I changed them. Right now, I'm not all that concerned about what an echo statement says so much as getting my code to build and run... Thanks for the pointers, though!
Thank you all for your input, I've changed == to = and -eq where you suggested, however, the fact still remains that so far this is NOT a problem with logic, so much as it IS a problem with syntax around ONE SPECIFIC IF STATEMENT
Is the problem segment right now. In fact, if this code alone, with no other logic arguments were to be entered, it would still produce the same error (but in a different numbered line)
Even if I were to put the "exit 0" commands outside of the if statement, it still returns with the same error. So, the problem is in the if statement, and not the logic. Could you please help me with this if statement? Seeing as the main one runs well enough so far.
Hello,
I have another problem with my script. Please accept my apologies, but I am really nooby in sh scripts. I am writing it for first time.
My script:
returned=`tail -50 SapLogs.log | grep -i "Error"`
echo $returned
if ; then
echo "There is no errors in the logs"
fi
And after... (10 Replies)
Hi,
I need help on following linux bash script. When I linux commands for loop or while loop on individual file it runs great. but now I want the script to run on N number of files so it gives me ambiguous redirect error on line 12 and syntax error on line 22 : (pls help );
#!/bin/bash
#... (16 Replies)
Solaris 10
This is my script:
#!/bin/bash
#Script to print number of users and print list of them
NO=`awk < /etc/passwd -F: '{ print $1 }' | wc -l`
echo There are $NO users on system.
echo "Do you want me to list them? (y or n):"
read YORN
if ]
awk < /etc/passwd -F: '{ print $1 }'... (5 Replies)
I am getting below error from this code (which is at line 24):
if ] #this is line24 in code
then
mv $File_source_path/$File_name $File_name'_'`date '+%d%m%y'`
Error:
line 24:
Any help with the syntax. I am putting 2 condition with 'AND' clause.
This is bash shell. (2 Replies)
Hi All
I am quite new to Unix. Following is a shell script that i have written and getting the subject mentioned error.
#!/bin/ksh
#-------------------------------------------------------------------------
# File: ang_stdnld.ksh
#
# Desc: UNIX shell script to extract Store information.... (3 Replies)
what is wrong with the below script:
---------------------------------------------------------------------------------
#!/bin/bash
echo "Setting JrePath..."
grep -w "export JrePath" /etc/profile
Export_Status=$?
if
echo "JrePath declared"
elif
echo "JrePath not declared"
echo... (2 Replies)
--------------------------------------------------------------------------------
Hello, help me please.
I am trying to create a mksysb bakup using nim. I am geting this error, how to correct it ? :
Command : failed stdout: yes stderr: no... (9 Replies)
hi there
i write one awk script file in shell programing
the code is related to dd/mm/yy to month, day year format
but i get an error
please can anybody help me out in this problem ??????
i give my code here including error
awk `
# date-month -- convert mm/dd/yy to month day,... (2 Replies)
#!/bin/sh
echo "Choose option: e, d, l, t, p, or x."
read option
if test $option = e
then
echo "Filename?"
read file
if test ! -f $file
then
echo "No such file"
else
echo "Yes its a file"
fi
... (4 Replies)