Sponsored Content
Top Forums Shell Programming and Scripting 1 Command - 2 Behaviours and a wrong false message Post 302931146 by Don Cragun on Sunday 11th of January 2015 01:54:02 AM
Old 01-11-2015
Quote:
Originally Posted by sea
Yahaah Smilie
With that knowledge i could fix the other toggle of the script working or not...
But that was in tui-printf, which tui-status called, but thank to you guys i knew what i needed to search for! Smilie

Thank you guys!

---------- Post updated at 07:18 ---------- Previous update was at 07:16 ----------

Would this also apply to the [[:space:]] ?
Code:
SEARCH="$( $GREP $OPT ^[[:space:]]${VARNAME}= "$CONFFILE"|$GREP -v ^#)"

As in, should i also place single quotes there?
Yes. Without quotes, if there are any files with filenames in the directory where your script is run that match the filename matching pattern ^[[:space:]]${VARNAME}=, you would have the same problem. This is probably less likely than in your previous example. Assuming that you want ${VARNAME} to be expanded in the regular expression you pass to grep, you want double quotes around the expression:
Code:
SEARCH="$( $GREP $OPT "^[[:space:]]${VARNAME}=" "$CONFFILE"|$GREP -v '^#')"

If you want to look for the literal string ${VARNAME}= immediately after a character of class space at the start of a line, you need to use single quotes and escape the dollar sign:
Code:
SEARCH="$( $GREP $OPT '^[[:space:]]\${VARNAME}=' "$CONFFILE"|$GREP -v '^#')"

This User Gave Thanks to Don Cragun For This Post:
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Whats wrong with the mv command

I am sorry guys I have figured out the error myself. (0 Replies)
Discussion started by: dsravan
0 Replies

2. Shell Programming and Scripting

Is anything wrong with this command

Hi All, can anyone tell me what is wrong with this command. tail -f /opt/olr-logs/PaymentGateway.log | grep "DEBUG - Start! AkhtarPaymentGateway - generateChecksum" | awk '{print $13}' | sed 's/,//g'>> abc But I found nothing in the file abc Please do help me.or Provide me some... (8 Replies)
Discussion started by: akhtar.bhat
8 Replies

3. UNIX for Advanced & Expert Users

what is wrong with this find command

i am trying to find the files which are more than 100MB and it was created 10 days ago. find /lola/loaded -size +102400 -mtime -10 -print | xargs ls -ltr -rw-rw-r-- 1 lola_adm gdrmp 82054170 Jun 23 06:17 /lola/loaded/ILMEMBER20090622.txt -rw-rw-r-- 1 lola_adm gdrmp 652080494 Jun 24... (3 Replies)
Discussion started by: sudhiroracle
3 Replies

4. UNIX for Dummies Questions & Answers

what is wrong with this command?

Hello, I try to using the below command to find out all the datafiles under "sja" direcotory. $ xargs -i find {} -type f -ls < sja /bin/ksh: sja: cannot open so can you tell me what is wrong? Thanks Jerry (3 Replies)
Discussion started by: GreatJerry
3 Replies

5. Shell Programming and Scripting

What's wrong with the following command?

Hi all, I'm trying to run the following command to get all files in one directory to another with the files' timestamps preserved, cp -p /logs/dvgbiau/batch/* /logs/dvgbiau/tmp_batch Note that ./batch and ./tmp_batch are two sub-directories under /logs/dvgbiau. The error was,... (1 Reply)
Discussion started by: isaacniu
1 Replies

6. Solaris

After command setenv auto-boot false machine's console not displaying

hi Alll, I want to install solaris 10 on exixting solaris mahcine. I tried for OK boot cdrom-install but it gave me fatal error - disk not bootable , boot command disable so i tried with ok setenv auto-boot? false Ok reset-all after this server rebooted automatically and... (2 Replies)
Discussion started by: sunray
2 Replies

7. Solaris

User account get locked due to strange behaviours

I am facing strange problem where after three failed login attempt user password must be locked. Actually what is happening, when I take the putty session of the server & enter user name on the prompt at the login prompt & then press enter to enter the password at this time when I checked the... (10 Replies)
Discussion started by: sb200
10 Replies

8. Shell Programming and Scripting

What is wrong with my awk command?

The below code usually works when the value for the COLUMN variable is numerical. but im in a situation where the number of fields in a file is not definitive. it changes. but what is static is that the value i want to retrieve from the log is 3 fields from the last field. which is what i... (9 Replies)
Discussion started by: SkySmart
9 Replies
All times are GMT -4. The time now is 07:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy