Variable with @ sign is driving me crazy


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Variable with @ sign is driving me crazy
# 1  
Old 04-23-2010
Variable with @ sign is driving me crazy

Ok so I am working on a command that is going to do a Dig @ a certain IP address which is enclosed in a variable.

Now I thought I had this figure out because it works. The problem is that it does not ALWAYS work.

the variable is IP=192.168.1.1

the commands I have tried are

Code:
dig @${IP} 
dig @"{$IP}"
dig '@'$IP
dig '@'"$IP"

I simply do not get it. All of these seem to work but not all the time. I'll go into one person box and it works fine and then the next one will not like it. Seems that the ones who do not like it are 1 version update behind the ones that do. But, I can't tell whats different. The bash version is the same and the freebsd version is the same. So somewhere somehow its not liking my formatting.

If I take the variable away and just do the command with the IP in there typed by hand it works fine.

Do you guys know what format would be the most universally accepted and least likely to be problematic?
# 2  
Old 04-23-2010
Quote:
Originally Posted by MrEddy
I simply do not get it. All of these seem to work but not all the time. I'll go into one person box and it works fine and then the next one will not like it.
What error messages do you get? What shells are you logging into? You could try escaping the @ with a \.
# 3  
Old 04-23-2010
*sigh* i'm retarded.. i wasn't using the full pathname for some files called later in the command.

So i was in the wrong directory and THAT was my issue. DOH!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to escape colon sign from variable in shell?

Hello, Below script works fine when I manually enter required information for each file. When it comes to shell in auto mode, it gives various errors. I am under ubuntu 14.04 / trusty. manual_run.sh: #!/bin/bash /usr/bin/ffmpeg -start_at_zero -copyts -i nicki.mp4 -c:v mpeg2video \ -b:v 500k... (3 Replies)
Discussion started by: baris35
3 Replies

2. Shell Programming and Scripting

Variable has value with = or == sign

I have a script which is reading value from property file and doing replacement in source location which contains multiple files. property file has values abc=xyz; yux=1;version=3.0; bcd=123;apple==mango when my script does search and reads value from property file. its replacing value... (1 Reply)
Discussion started by: Shamkamde
1 Replies

3. UNIX for Dummies Questions & Answers

UNIX/Linux/Distributions - driving me crazy...

Hello there, first of all: I do not want to become a hacker. you cannot do that. you cannot learn that from a book. Don't think I'm some kind of a script-kiddie. now that's settled let's start. I've been trying around with a lot of OS lately. I have backtrack5 installed on my notebook,... (10 Replies)
Discussion started by: Dr. Nick
10 Replies

4. Shell Programming and Scripting

PERL : check + or - sign in a variable

I have a variable $max = -3; It can be $max = +3; I need to check if this variable is a positive/negative value. if its positive, should print "positive" if not "negative" How can this be done? Thanks in advance (2 Replies)
Discussion started by: irudayaraj
2 Replies

5. What is on Your Mind?

Here's To The Crazy One

Please excuse my indulgence. Thank you MG Siegler and Steve Jurvetson. But most importantly, thank you Steve Jobs. 8rwsuXHA7RA The world has lost a genius. (1 Reply)
Discussion started by: Scott
1 Replies

6. Shell Programming and Scripting

Escape Characters are driving me crazy!

Hi everyone, Is there anywhere I can find a complete table of all characters that must be escaped by the various UNIX shells and scripting languages? It seems every command/shell/scripting language has different rules about what characters must be escaped. I do a lot of searching and... (3 Replies)
Discussion started by: troym72
3 Replies

7. Shell Programming and Scripting

PERL cgi script... extra character driving me crazy

I'm using a PERL cgi script that uses rrdtool to make graphs. I can't get the syntax correct to use a degree sign (alt+0176 like this °) and also using a variable. If I use single quotes, I can't call the variable. If I use double quotes, there is an extra symbol (Â) before the ° which goes... (2 Replies)
Discussion started by: audiophile
2 Replies

8. Shell Programming and Scripting

Pleas help..this is driving me crazy

Hi, I've created a script in csh that takes a file and checks it for mispelled words. Im almost done but I need to do two more things but I need help. First, when displaying an incorrect word to the user, I need to show the line of the input file that contains the word. Second,if the user... (0 Replies)
Discussion started by: hckygoli31
0 Replies

9. Shell Programming and Scripting

Sign on/Sign off logging script

I'd like to make a script that I can execute every time I sign on to my linux box that keeps track of the time and allows to me to add a remark to a file. So basically once I log in, I run the script, and it outputs the date and time to a text file (log.txt). But that isn't my problem. I need... (1 Reply)
Discussion started by: Glider
1 Replies

10. UNIX for Dummies Questions & Answers

unix driving me crazy

:( :confused: what is performed by the following unix command: grep -v Jane project1.txt and grep ' 5\..' janet.txt (1 Reply)
Discussion started by: Tendernisin
1 Replies
Login or Register to Ask a Question