Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old May 26, 2009, 02:53 PM   #1
hiddenpremise
macrumors regular
 
Join Date: Jul 2008
Location: Somewhere between my imagination and reality
Bash script - concatenation woes

I am trying to take my computer's name and pass it in the query line of a url. So far I can get the computer name, but I can't get the URL to assign to a variable.
This is what I wrote
Code:
BASEURL="http://isis/db.php?compname="
COMPNAME= /usr/sbin/networksetup -getcomputername
FINAL= ${BASEURL}${COMPNAME}
curl $FINAL
This is the output I get
Code:
testdb.sh: line 4: http://isis/db.php?compname=: No such file or directory
Any ideas?
__________________
MBP i7 | iPhone 4 | iPad
hiddenpremise is offline   0 Reply With Quote
Old May 26, 2009, 03:05 PM   #2
lee1210
macrumors 68040
 
lee1210's Avatar
 
Join Date: Jan 2005
Location: Dallas, TX
COMPNAME=`/usr/sbin/networksetup -getcomputername`

Those are backticks. On a US keyboard this shared the ~ key next to the 1 key.

-Lee

EDIT: Not sure if this will fix the error you are getting, though...
lee1210 is offline   0 Reply With Quote
Old May 26, 2009, 03:40 PM   #3
pilotError
macrumors 68020
 
pilotError's Avatar
 
Join Date: Apr 2006
Location: Long Island
You can do the following:

Code:
MYURL="http://isis/db.php?compname=${HOSTNAME}"
curl $MYURL
pilotError is offline   0 Reply With Quote
Old May 27, 2009, 07:06 AM   #4
hiddenpremise
Thread Starter
macrumors regular
 
Join Date: Jul 2008
Location: Somewhere between my imagination and reality
Thanks guys! Yall have been a great help!
__________________
MBP i7 | iPhone 4 | iPad
hiddenpremise is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Learning BASH scripting for Mac oxfordguy Mac Programming 3 Nov 17, 2011 05:06 PM
Use backslash in Applescript running a Bash Shell Script rebello95 Mac Programming 12 Nov 3, 2011 01:56 PM
Help making Bash Script work with Lion? Yujenisis Mac Programming 4 Sep 13, 2011 02:57 PM
BASH Script - Launch App with arguments? Isoparm OS X 0 Jun 1, 2011 02:34 PM
Need help with bash script - symlink problems Poeben Mac Programming 4 Sep 14, 2007 08:36 PM


All times are GMT -5. The time now is 05:34 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC