I want to check whether certain arguments were passed to the script, and when those are, not doing a log entry.
If those arguments are not passed, always do a log entry (*new call*).
What currently i have is this:
Which upon these 2 commands, produces these lines within the logfiles:
With echo i have the expected output:
However, as soon i change echo to become printf, it produces this (not wanted):
In addition i wanted to use [[:space:]]\\-[Lih], but i assume that is another issue?
I've tried quoting the regex, but still fails.
But keeping the idea of using printf and grep, perhaps you want:
Now we know we had 2 of the 3 options...
Although the filenames -L-i, and -h are not common, scripts should always assume that they might be present. Therefore, the grep -[Lih] operand should be quoted:
This User Gave Thanks to Don Cragun For This Post:
Thanks Don (and Neutron too), that thought was actualy in mind, but only as part of a filename.
That just solved my 2nd question, i still was fiddling around, me used the wrong quotes
EDIT:
Weird, the solved tag didnt put a [solved] prior to the threads title..
Thanks Don (and Neutron too), that thought was actualy in mind, but only as part of a filename.
That just solved my 2nd question, i still was fiddling around, me used the wrong quotes
EDIT:
Weird, the solved tag didnt put a [solved] prior to the threads title..
You can search on tags like solved, but they don't change the title of your thread. The solved tag is special in that it also has the side-effect of changing the color used when displaying the title of the thread from black to blue.
This User Gave Thanks to Don Cragun For This Post:
Hello,
I've been trying to find the answer to this with Google and trying to browse the forums, but I haven't been able to come up with anything. If this has already been answered, please link me to the thread as I can't find it.
I've been asked to write a script that pulls a list of our CPE... (51 Replies)
Heyas
I'm currently attempting to apply the code of tui-select to tui-list.
That is because tui-list simply made a 1 string list, while tui-select uses dynamicly up to 3 strings per line.
Anyway, so i copy pasted the code, and just made the changes marked with red....
Know that both scripts... (2 Replies)
Hello,
For some reason i dont remember, i currently believe (but beeing unsure) that printf is available on more diffrent systems (unix, bsd, linux, ??) than echo is.
Could someone please enlighten me, whether this is true or not?
Thank you
PS:
I just found pages about the diffrences of... (3 Replies)
Hello script guru's
as i write more and more code i always block at managing output... either writing to standard out, writing to files via std out (log, temp file, etc). Don't get me wrong 99% of the time it DOES the job but maybe there is more efficient.
I'm writing a small script to... (2 Replies)
Hi,
I have issue with cron.
When i run script manually output is fine but when i add it to cron output file is not as same.
both file attach some junk charecter comming in cron output.
thanx
Jignesh (5 Replies)
This may be little confusing. I have Script1, which pulls data from the system and creates another script(lets say script2). While I run script1 I need to add printf/echo statements for script2, so that when I run script2 I see those statement.
eg: script1 765
printf " display frame-$1 timeoffset... (2 Replies)
#!/usr/bin/ksh
var1="Hi World"
var2="Morning"
var3=$(echo "$var1" \n "$var2")
echo $var3
var3=$(printf "$var1 \n $var2")
echo $var3
Output
Any way to get
in my $var3 ? (7 Replies)
I want to print a colored line using bash. I want to print:
Smtp status
where "Smtp status" will be in yellow and will be in green.
Thanks. (2 Replies)
I am performing a grep command and I need to know how to echo "NONE" or "0" to my file if grep does not find what i am looking for.
echo What i found >> My_File
grep "SOMETHING" >> My_File
I am sure this is easy, I am sort of new at this!
Thanks (2 Replies)
When I type a command at the command line it supplies one result and the exact same command in a script
egrep '^01|^02|^03|^04' file > fileout
count = 29353
same count in the script yields a count of 23492
is there any reason this could be happening. (1 Reply)