Sponsored Content
Top Forums Shell Programming and Scripting how to use in bash variables and quotes Post 302306186 by aspire on Saturday 11th of April 2009 12:23:24 PM
Old 04-11-2009
how to use in bash variables and quotes

I have some troubles with variables and quotes...

I want:

if $URL is empty (no user input) go to http://www.localhost/index.php/ else add this string (search) "?s=+$URL"

EXAMPLE:
No user input
string= http://www.localhost/index.php/

User input = "unix"
string= http://www.localhost/index.php/s=+unix

No luck with:


Code:
#!/bin/bash

read URL
#if [ $? = 1 ];
#then exit
#fi
LINK=$("http://www.localhost/index.php/")
SEARCH=$("?s=+$URL")
if [ $var == "" ]
then
LINK1=$(lynx -dump $LINK)
else
LINK1=$(lynx -dump $LINK$SEARCH)
fi
# exec command:
exec $LINK1


Output:


line 8: ?s=+unix: command not found
line 9: [: ==: unary operator expected
line 16: Lynx: command not found

Last edited by aspire; 04-11-2009 at 01:58 PM..
 

10 More Discussions You Might Find Interesting

1. AIX

how to pass variables surrounded in double quotes to awk?

Hi, I'm making progress on this but hung up on one last detail. I'd like to use AWK to pass the system date and time(among other things) to the first line of a file. Here's what I have: BEGIN {TOTALPP = 0;FREEPP=0;USEDPP=0;print "LPAR NAME:",lpar,"DATE:",tdate } I call AWK with the... (4 Replies)
Discussion started by: cruiser
4 Replies

2. Shell Programming and Scripting

Retain quotes from bash script arguments

Hi there, I've been scouring these forums and have found similar threads, but none apparently helped me solved my problem :rolleyes: I'd like to run a command within a bash script, but that command is provided by the user to the script and may contain quotes, which is where the problem lies.... (9 Replies)
Discussion started by: cypression
9 Replies

3. Shell Programming and Scripting

Use variables with double quotes sed -i

I have the following line of code: sed -i "/MatchText/ s/${tgrepLine}/${tNewLine}/" filename.outputfilename.output contains this: blablabla PATH=".:/home/root/bin/:/usr/local/bin/" blablablaVariable ${tgrepLine} contains: PATH=".:/home/root/bin/:/usr/local/bin/" Variable ${tNewLine}... (3 Replies)
Discussion started by: inspire87
3 Replies

4. Shell Programming and Scripting

quotes in shell variables

On my Debian system under bash the following command returns 24 files. find /root/bin/ -name '*' while the following returns none FIND="-name '*'"; find /root/bin/ $FIND Asking on the Debian Users list I've been shown work arounds but not explanations. I'm hoping someone here can explain 'why'... (3 Replies)
Discussion started by: mmcclain
3 Replies

5. UNIX for Dummies Questions & Answers

Is there a way to set ' and " as a non quotes type in bash?

Howdy, I got a script that adds a esc char before all chars interpeted by bash shell but I wan't other solution. Is there a way to set ' and " as a non quotes type in bash (some local variable)? Have found that scsh is a non-quoting type shell but after reading Why I don't use scsh as a scripting... (3 Replies)
Discussion started by: johny_be_good
3 Replies

6. Shell Programming and Scripting

How to count number of double quotes in bash

Need a little help. I have just a simple string with a lot double quotes in it. I need to be able to parse through this string, and know how many double quotes I have, and where I am, so I can key off every 9th double quote. For example (coding is not complete): #!/bin/bash count=0... (3 Replies)
Discussion started by: Akilleez
3 Replies

7. Shell Programming and Scripting

Complex bash/sed, variables and nested quotes

Ok, this one isn't for everybody, it's pretty tough and I've spent a good deal of time on it without figuring it out yet. Can anybody get this script to work: #!/bin/bash cq_fname="%let outputfile="/user/cq_"$1".csv";" sed "29s/.*/\"$cq_fname\"/" file1.sas >... (3 Replies)
Discussion started by: nocloud
3 Replies

8. Shell Programming and Scripting

Passing awk variables to bash variables

Trying to do so echo "111:222:333" |awk -F: '{system("export TESTO=" $2)}'But it doesn't work (2 Replies)
Discussion started by: urello
2 Replies

9. UNIX for Beginners Questions & Answers

Bash not recognizing single quotes in Mac?

Hi, I just bought a new mac and have been running a program out of terminal, but even early on I noticed that my single quotes looked a lot different from the ones used in all of the namelists and other files of the program. Specifically, mine are kind of slanted whereas the others are very... (7 Replies)
Discussion started by: jtcastro99
7 Replies

10. Shell Programming and Scripting

Complex: bash, using ANSI-C quotes in skript

Hello, I hope someone can hep with this. I use a skript to send multiline Data to a Monitoring system. Bu I'm not able to use linebreaks or escape sequences. The skript is simple like that: #!/bin/bash var="Erste Zeile \n zweite Zeile \n Dritter Teil" zabbix_sender -c... (17 Replies)
Discussion started by: mpmichael
17 Replies
httppower(8)							     powerman							      httppower(8)

NAME
httppower - communicate with HTTP based power distribution units SYNOPSIS
httppower [--url URL] DESCRIPTION
httppower is a helper program for powerman which enables it to communicate with HTTP based power distribution units. It is run interac- tively by the powerman daemon. OPTIONS
-u, --url URL Set the base URL. INTERACTIVE COMMANDS
The following commands are accepted at the httppower> prompt: auth user:pass Authenticate to the base URL with specified user and password, using ``basic'' HTTP authentication which sends the user and password over the network in plain text. seturl URL Set the base URL. Overrides the command line option. get [URL-suffix] Send an HTTP GET to the base URL with the optional URL-suffix appended. post [URL-suffix] key=val[&key=val]... Send an HTTP POST to the base URL with the optional URL-suffix appended, and key-value pairs as argument. FILES
/usr/sbin/httppower /etc/powerman/powerman.conf ORIGIN
PowerMan was originally developed by Andrew Uselton on LLNL's Linux clusters. This software is open source and distributed under the terms of the GNU GPL. SEE ALSO
powerman(1), powermand(8), httppower(8), plmpower(8), vpcd(8), powerman.conf(5), powerman.dev(5), powerman-devices(7). http://sourceforge.net/projects/powerman powerman-2.3.5 2009-02-09 httppower(8)
All times are GMT -4. The time now is 05:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy