08-16-2011
Quote:
Originally Posted by
dude2cool
Try double quotes around that entire string.
Absolutely no point. Anything that could possibly be special to the shell is already protected by strong quotes (single quotes).
Regards,
Alister
---------- Post updated at 09:22 PM ---------- Previous update was at 09:17 PM ----------
Quote:
Originally Posted by
andreirp
Thanks for the reply.
Exactly, but I would like to add multiple lines and this command line would I assign a variable as:
$exec = "sed '1731a\ ####' squid.conf'"
How will I assign a variable with line break?
The output in a text file "squid.conf" would be:
#####
acl TESTE_ip src 192.168.1.1/255.255.255.255
########
tksss
That command line will most likely just throw an error. You can't have whitespace around the "=" in an assignment.
Why don't you do yourself and us a favor and walk us through what it is that you are trying to accomplish. Step by step. Assume nothing. Break it down. Give us a few lines of input and the expected output. If you are trying to assign or extract something into a variable, give us context.
Regards,
Alister
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi folks,
Our application installation uses "sed" command to append string after specific line or after line number.
Both cases work perfect on Linux but fail on Solaris.
The OS versions are Solaris 9 and Linux Red Hat AS 3.
i.g:
Linux:
-----
file foo.txt
aaa
bbb
ccc
ddd
root#... (4 Replies)
Discussion started by: nir_s
4 Replies
2. UNIX for Dummies Questions & Answers
i got my computer in 2k, built it myself. top of the line then and better than most still now.
one problem however is i was never able to install unix because the old kernels were not compatible with SATA hard drives
i dont have any IDE drives nor do i want any
I want mine on SATA, but every... (5 Replies)
Discussion started by: GXDeMoNN
5 Replies
3. UNIX for Dummies Questions & Answers
Hi everybody ,
I'm new here in the forum and new Dummy in L|U systems (Hope finding welcomes...:)).
I just want to ask : What is the OS's that works on servers and the OS's that work as client OS??
I just know that Solaris Work on sarvers :D..
and i'm glad to be memmber in this... (1 Reply)
Discussion started by: derbi
1 Replies
4. UNIX for Dummies Questions & Answers
I set up remote printing on a clients Unix server to my Windows XP USB printer. My USB printer is connected directly to my PC (no print server and no network input on printer). With my Win XP PC connected to my cable modem (without the router), i can do
lp -dhp842c /etc/hosts and it prints. I... (7 Replies)
Discussion started by: jmhohne
7 Replies
5. Shell Programming and Scripting
I have this simple script:
#! /usr/bin/sh
#*****************************************************************************
# *** get_input (question variable) ***
#*****************************************************************************
get_input ()
{
echo "${BOLD}${1} : "
read... (14 Replies)
Discussion started by: C|KiLLeR|S
14 Replies
6. Shell Programming and Scripting
Hi all,
Our application installation uses "sed" command to delete rest of line. It work perfect on Linux but fail on Solaris.
The OS versions are Solaris 9 and Linux Red Hat AS 3.
yourfile.txt
hello and world
cat and dog
hello world
in linux:
cat yourfile.txt | sed ‘s/\(\+\)... (3 Replies)
Discussion started by: javac2005
3 Replies
7. Shell Programming and Scripting
Hi, I have a question.
I define a function using sed command:
replace()
{
searchterm=$1
replaceterm=$2
sed -e "s/$searchterm/$replaceterm/ig" $3 > $WORK'tempfile.tmp'
mv $WORK'tempfile.tmp' $3
}
Then I call
replace 'test = 0' 'test = 1' $myfileThis code works well in... (1 Reply)
Discussion started by: Dark2Bright
1 Replies
8. Shell Programming and Scripting
Hi, I have a question.
I define a function using sed command:
replace()
{
searchterm=$1
replaceterm=$2
sed -e "s/$searchterm/$replaceterm/ig" $3 > $WORK'tempfile.tmp'
mv $WORK'tempfile.tmp' $3
}
Then I call
replace 'test = 0' 'test = 1' $myfile
This code... (1 Reply)
Discussion started by: Dark2Bright
1 Replies
9. Shell Programming and Scripting
Hello,
I have a ksh script that uses code below. For some reason it works under linux but fails in unix. Any idea why?
if ]; then ...
Thanks (9 Replies)
Discussion started by: rdogadin
9 Replies
10. Shell Programming and Scripting
Hi,
On Linux i get the desired ouput:
echo "<value>WEB_USER</value>" | sed 's/\(<value>\|<\/value>\)//g'Output:
Executing the same command on Solaris:
echo "<value>WEB_USER</value>" | sed 's/\(<value>\|<\/value>\)//g'Output:
I need to get the desired output on Solaris i.e. WEB_USER and... (4 Replies)
Discussion started by: mohtashims
4 Replies
LEARN ABOUT NETBSD
ifconfig.if
IFCONFIG.IF(5) BSD File Formats Manual IFCONFIG.IF(5)
NAME
ifconfig.if -- interface-specific configuration files or variables
DESCRIPTION
The ifconfig.if files or variables contain information regarding the configuration of each network interface. ifconfig.if is processed by
/etc/rc.d/network at system boot time.
For each interface (nnX) that is to be configured, there should be either an ifconfig_nnX variable in rc.conf(5), or an /etc/ifconfig.nnX
file (such as the ifconfig_fxp0 variable or the /etc/ifconfig.fxp0 file for the fxp0 interface). Only characters allowed in sh(1) variables
names should be used for nnX (ascii(7) uppercase and lowercase letters, digits, and underscore).
The variable or file will get evaluated only if the interface exists on the system. Multiple lines can be placed in a variable or file, and
will be evaluated sequentially. In the case of a variable, semicolons may be used instead of newlines, as described in rc.conf(5).
<backslash><newline> sequences in files are ignored, so long logical lines may be made up of several shorter physical lines.
Normally, a line will be evaluated as command line arguments to ifconfig(8). ``ifconfig nnX'' will be prepended on evaluation. Arguments
with embedded shell metacharacters should be quoted in sh(1) style.
If the line is equal to ``dhcp'', dhcpcd(8) will be started for the interface. However, it is instead recommended that dhcpcd is set to true
in rc.conf(5) and any per interface configuration or restriction is done in dhcpcd.conf(5).
If a line is empty, or starts with '#', the line will be ignored as comment.
If a line starts with '!', the rest of line will get evaluated as shell script fragment. Shell variables declared in /etc/rc.d/network are
accessible but may not be modified. The most useful variable is $int, as it will be bound to the interface being configured with the file.
For example, the following illustrates static interface configuration:
# IPv4, with an alias
inet 10.0.1.12 netmask 255.255.255.0 media 100baseTX
inet 10.0.1.13 netmask 255.255.255.255 alias
# let us have IPv6 address on this interface
inet6 2001:db8::1 prefixlen 64 alias
# have subnet router anycast address too
inet6 2001:db8:: prefixlen 64 alias anycast
The following illustrates dynamic configuration setup with dhclient(8) and rtsol(8):
up
# autoconfigure IPv4 address
!dhclient $int
# autoconfigure IPv6 address. Be sure to set $ip6mode to autohost.
!rtsol $int
The following example sets a network name for a wireless interface (using quotes to protect special characters in the name), and starts
dhcpcd(8):
ssid 'my network'
dhcp
The following example is for dynamically-created pseudo interfaces like gif(4). Earlier versions of /etc/rc.d/network required an explicit
'create' command for such interfaces, but creation is now handled automatically.
up
# configure IPv6 default route toward the interface
!route add -inet6 default ::1
!route change -inet6 default -ifp $int
FILES
/etc/rc.d/network
SEE ALSO
rc.conf(5), ifconfig(8)
BSD
April 7, 2011 BSD