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

Similar Threads
thread Thread Starter Forum Replies Last Post
changed bash to tcsh in gui MAC OS 10.5.8 how to chage back to bash? Mac10.5.8USER OS X 0 Feb 3, 2014 04:45 PM
what is JBOD (Concatenation/Spanned)? Sossity Mac Peripherals 5 Feb 16, 2013 11:49 AM
While loop help - Bash Script BerGaur OS X 10.8 Mountain Lion 2 Dec 24, 2012 02:55 PM
SOLVED IT! [Bash script, caffeinate - help] dasx Mac Programming 8 Nov 21, 2012 04:16 PM
Assistance with bash script, read from file djjasonsa Mac Programming 1 Jun 4, 2012 07:52 AM

Forum Jump

All times are GMT -5. The time now is 10:40 AM.

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

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