|
View:
New views
18 Messages
—
Rating Filter:
Alert me
|
|
|
[OT] run command via ssh - problemHi,
I'm running a command like this: for i in server1 server2;do ssh root@$i "`hostname`";done. However the hostname command always outputs the hostname of the server that the above command is run from. I'd like to know how to run this hostname command so that it actually runs on server 1, server2 etc.. Thanks Dan -- fedora-list mailing list fedora-list@... To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines |
|
|
Re: [OT] run command via ssh - problemOn Wed, Nov 4, 2009 at 1:10 PM, Dan Track <dan.track@...> wrote:
> Hi, > > I'm running a command like this: > > for i in server1 server2;do ssh root@$i "`hostname`";done. > > However the hostname command always outputs the hostname of the server > that the above command is run from. I'd like to know how to run this > hostname command so that it actually runs on server 1, server2 etc.. > > Thanks > Dan > Sorry just to add the actual script was like this: for i in server1 server2;do ssh root@$i "DNSNAME=\"basename \`hostname\`\";echo $DNSNAME";done Thanks Dan -- fedora-list mailing list fedora-list@... To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines |
|
|
Re: [OT] run command via ssh - problemOn 11/04/2009 02:10 PM, Dan Track wrote:
> Hi, > > I'm running a command like this: > > for i in server1 server2;do ssh root@$i "`hostname`";done. > > However the hostname command always outputs the hostname of the server > that the above command is run from. I'd like to know how to run this > hostname command so that it actually runs on server 1, server2 etc.. > > Thanks > Dan > for i in server1 server2;do ssh root@$i '`hostname`';done. Explanation: `hostname`, or $(hostname), is already evaluated on the source host by your shell (even inside of "...") , not on the target host. -- Joachim Backes <joachim.backes@...> http://www.rhrk.uni-kl.de/~backes -- fedora-list mailing list fedora-list@... To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines |
|
|
Re: [OT] run command via ssh - problemOn Wed, 2009-11-04 at 13:10 +0000, Dan Track wrote:
> Hi, > > I'm running a command like this: > > for i in server1 server2;do ssh root@$i "`hostname`";done. > > However the hostname command always outputs the hostname of the server > that the above command is run from. I'd like to know how to run this > hostname command so that it actually runs on server 1, server2 etc.. Just remove the backticks and quotes around hostname? for i in server1 server2;do ssh root@$i hostname;done The backticks tell the shell (on your machine) to run the command inside the backticks and replace that part of the command line with the output of the command so you actually end up with a command line like: for i in server1 server2;do ssh root@$i mylocalhostname;done. Regards, Bryn -- fedora-list mailing list fedora-list@... To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines |
|
|
Re: [OT] run command via ssh - problemOn Wed, Nov 4, 2009 at 1:14 PM, Joachim Backes
<joachim.backes@...> wrote: > On 11/04/2009 02:10 PM, Dan Track wrote: >> >> Hi, >> >> I'm running a command like this: >> >> for i in server1 server2;do ssh root@$i "`hostname`";done. >> >> However the hostname command always outputs the hostname of the server >> that the above command is run from. I'd like to know how to run this >> hostname command so that it actually runs on server 1, server2 etc.. >> >> Thanks >> Dan >> > > Use the following > for i in server1 server2;do ssh root@$i '`hostname`';done. > > > Explanation: `hostname`, or $(hostname), is already evaluated on the source > host by your shell (even inside of "...") , not on the target host. > -- > > Joachim Backes <joachim.backes@...> > > http://www.rhrk.uni-kl.de/~backes > Thanks for that, any thoughts on how it fits in with my script: for i in server1 server2;do ssh root@$i "DNSNAME=\"basename\`hostname\`\";echo $DNSNAME";done Thanks Dan -- fedora-list mailing list fedora-list@... To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines |
|
|
Re: [OT] run command via ssh - problemOn Wed, 2009-11-04 at 13:13 +0000, Dan Track wrote:
> On Wed, Nov 4, 2009 at 1:10 PM, Dan Track <dan.track@...> wrote: > > Hi, > > > > I'm running a command like this: > > > > for i in server1 server2;do ssh root@$i "`hostname`";done. > > > > However the hostname command always outputs the hostname of the server > > that the above command is run from. I'd like to know how to run this > > hostname command so that it actually runs on server 1, server2 etc.. > > > > Thanks > > Dan > > > > Sorry just to add the actual script was like this: > > for i in server1 server2;do ssh root@$i "DNSNAME=\"basename > \`hostname\`\";echo $DNSNAME";done Not sure why you're setting a variable here but to have "basename" run as a command and assign the output to DNSNAME you need to have basename inside a pair of backticks too. You'll then hit another problem because you want to have nested backticks (one pair for basename and another for hostname). Bash supports '$()' as an alternative to backticks that does allow nesting - writing $(hostname) is equivalent to `hostname` and allows you to write $(basename $(hostname)). I'm not sure basename is going to do what you want here though - are you looking for the short host name or the domain name? The basename command separates components of a path based on the '/' (or whatever the system defined path separator is). E.g.: $ DNS=$(basename $(hostname)) $ echo $DNS breeves.fab.redhat.com If you just want the short hostname you can pass -s to hostname: $ ssh pe1950-1.gsslab hostname -s pe1950-1 Or the domain with -d: $ ssh pe1950-1.gsslab hostname -d gsslab.fab.redhat.com Have a look at the man page for hostname for more options. Regards, Bryn. -- fedora-list mailing list fedora-list@... To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines |
|
|
Re: [OT] run command via ssh - problemDan Track wrote:
> Thanks for that, any thoughts on how it fits in with my script: > > for i in server1 server2;do ssh root@$i > "DNSNAME=\"basename\`hostname\`\";echo $DNSNAME";done What are you trying to achieve with DNSNAME=\"basename\`hostname\`\"; anyway? If you want the domainname, dnsdomainname or hostname -d seem better. The basename command is for finding the base name of a file. If the domainname is what you want, something like this would work: for i in server{1..2}; do ssh root@$i 'DNSNAME=$(hostname -d); echo $DNSNAME' done I presume you have other steps in between DNSNAME=... and the echo, otherwise you would just use ssh root@$i hostname -d. -- Todd OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I look up to the heaven's for a ray of hope to shine. And there it is in neon: Liquor, beer, and wine. -- fedora-list mailing list fedora-list@... To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines |
|
|
Re: [OT] run command via ssh - problemOn Wed, Nov 4, 2009 at 1:33 PM, Bryn M. Reeves <bmr@...> wrote:
> On Wed, 2009-11-04 at 13:13 +0000, Dan Track wrote: >> On Wed, Nov 4, 2009 at 1:10 PM, Dan Track <dan.track@...> wrote: >> > Hi, >> > >> > I'm running a command like this: >> > >> > for i in server1 server2;do ssh root@$i "`hostname`";done. >> > >> > However the hostname command always outputs the hostname of the server >> > that the above command is run from. I'd like to know how to run this >> > hostname command so that it actually runs on server 1, server2 etc.. >> > >> > Thanks >> > Dan >> > >> >> Sorry just to add the actual script was like this: >> >> for i in server1 server2;do ssh root@$i "DNSNAME=\"basename >> \`hostname\`\";echo $DNSNAME";done > > Not sure why you're setting a variable here but to have "basename" run > as a command and assign the output to DNSNAME you need to have basename > inside a pair of backticks too. > > You'll then hit another problem because you want to have nested > backticks (one pair for basename and another for hostname). Bash > supports '$()' as an alternative to backticks that does allow nesting - > writing $(hostname) is equivalent to `hostname` and allows you to write > $(basename $(hostname)). > > I'm not sure basename is going to do what you want here though - are you > looking for the short host name or the domain name? The basename command > separates components of a path based on the '/' (or whatever the system > defined path separator is). E.g.: > > $ DNS=$(basename $(hostname)) > $ echo $DNS > breeves.fab.redhat.com > > If you just want the short hostname you can pass -s to hostname: > > $ ssh pe1950-1.gsslab hostname -s > pe1950-1 > > Or the domain with -d: > > $ ssh pe1950-1.gsslab hostname -d > gsslab.fab.redhat.com > > Have a look at the man page for hostname for more options. > > Regards, > Bryn. Hi Bryn, Many thanks. I tried hostname -s but I keep getting the following: hostname: Host name lookup failure This may be because the hostname's are short already e.g just "server1" instead of "server1.example.com" I've updated teh script to your recommendations but I still get the local hosts hostname in teh output instead of the remote servers hostname. Any other thoughts? I now run the following: for i in server1 server2;do ssh root@$i "DNSNAME=$(basename $(hostname)$);echo $DNSNAME";done Thanks Dan -- fedora-list mailing list fedora-list@... To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines |
|
|
Re: [OT] run command via ssh - problemOn Wed, 2009-11-04 at 14:14 +0100, Joachim Backes wrote:
> On 11/04/2009 02:10 PM, Dan Track wrote: > > Hi, > > > > I'm running a command like this: > > > > for i in server1 server2;do ssh root@$i "`hostname`";done. > > > > However the hostname command always outputs the hostname of the server > > that the above command is run from. I'd like to know how to run this > > hostname command so that it actually runs on server 1, server2 etc.. > > > > Thanks > > Dan > > > > Use the following > for i in server1 server2;do ssh root@$i '`hostname`';done. That will try to execute the name of the remote host as though it was a command (backticks expand on the remote host and the output of the hostname command is used as the command line). $ ssh abox '`hostname`' bash: abox.example.com: command not found Bryn. -- fedora-list mailing list fedora-list@... To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines |
|
|
Re: [OT] run command via ssh - problemOn Wed, 2009-11-04 at 13:32 +0000, Dan Track wrote:
> Hi Bryn, > > Many thanks. I tried hostname -s but I keep getting the following: > > hostname: Host name lookup failure Possibly your resolver on the servers is not configured to search its own local domain. Add a line like this to /etc/resolv.conf: search mylocaldomain.com Or, if you configure the resolver via dhcp add a directive on the server to pass this over to clients. > This may be because the hostname's are short already e.g just > "server1" instead of "server1.example.com" > > I've updated teh script to your recommendations but I still get the > local hosts hostname in teh output instead of the remote servers > hostname. Any other thoughts? > > I now run the following: > > for i in server1 server2;do ssh root@$i "DNSNAME=$(basename > $(hostname)$);echo $DNSNAME";done You need to use single quotes instead of double quotes - see the rules in the bash man page about quote expansion. A single quoted string is not subject to any expansion by the shell on the client machine but a double quoted string will be expanded on the client before the ssh command is executed. $ ssh abox 'DNSNAME=$(basename $(hostname));echo $DNSNAME' abox.example.com I still don't think that basename will do what you want here... Regards, Bryn. -- fedora-list mailing list fedora-list@... To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines |
|
|
Re: [OT] run command via ssh - problemOn Wed, Nov 4, 2009 at 2:29 PM, Bryn M. Reeves <bmr@...> wrote:
> On Wed, 2009-11-04 at 13:32 +0000, Dan Track wrote: >> Hi Bryn, >> >> Many thanks. I tried hostname -s but I keep getting the following: >> >> hostname: Host name lookup failure > > Possibly your resolver on the servers is not configured to search its > own local domain. Add a line like this to /etc/resolv.conf: > > search mylocaldomain.com > > Or, if you configure the resolver via dhcp add a directive on the server > to pass this over to clients. > >> This may be because the hostname's are short already e.g just >> "server1" instead of "server1.example.com" >> >> I've updated teh script to your recommendations but I still get the >> local hosts hostname in teh output instead of the remote servers >> hostname. Any other thoughts? >> >> I now run the following: >> >> for i in server1 server2;do ssh root@$i "DNSNAME=$(basename >> $(hostname)$);echo $DNSNAME";done > > You need to use single quotes instead of double quotes - see the rules > in the bash man page about quote expansion. A single quoted string is > not subject to any expansion by the shell on the client machine but a > double quoted string will be expanded on the client before the ssh > command is executed. > > $ ssh abox 'DNSNAME=$(basename $(hostname));echo $DNSNAME' > abox.example.com > > I still don't think that basename will do what you want here... > > Regards, > Bryn. Great that single quote worked. It's nwo returning the correct result. Many thanks. The basename command works well. Thanks Dan -- fedora-list mailing list fedora-list@... To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines |
|
|
Re: [OT] run command via ssh - problemDan Track wrote:
> The basename command works well. At what? Unless your hostname contains a /, I don't see how basename would do anything the way you are using it. -- Todd OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Oh, very funny! Now tell the one that doesn't suck. -- Stewie Griffin -- fedora-list mailing list fedora-list@... To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines |
|
|
Re: run command via ssh - problemOn 04Nov2009 14:56, Dan Track <dan.track@...> wrote:
| On Wed, Nov 4, 2009 at 2:29 PM, Bryn M. Reeves <bmr@...> wrote: | >> for i in server1 server2;do ssh root@$i "DNSNAME=$(basename | >> $(hostname)$);echo $DNSNAME";done | > | > You need to use single quotes instead of double quotes - see the rules | > in the bash man page about quote expansion. A single quoted string is | > not subject to any expansion by the shell on the client machine but a | > double quoted string will be expanded on the client before the ssh | > command is executed. | > | > $ ssh abox 'DNSNAME=$(basename $(hostname));echo $DNSNAME' | > abox.example.com | > | > I still don't think that basename will do what you want here... | | Great that single quote worked. It's nwo returning the correct result. | Many thanks. The basename command works well. I'm echoing from both Todd and Bryn's remarks about basename being useless here (try replacing $(basename $(hostname)) with just $(hostname) and see the script do exactly the sam thing). However, I want to point out that because ssh hands its arguments-joined-together-with-spaces to the shell at the far end, you can do a lot of testing like this: sh -c 'some shell command...' and when happy, run it remotely thus: ssh remote-host 'some shell command...' Also, to see how it is looking while debugging, you can do this: ( set -x sh -c 'some shell command...' ) or on one line if you're command line editing: ( set -x; sh -c 'some shell command...' ) to see how the 'some shell command...' bit is prepared (since in your real world example that's got double quotes and stuff), and you can also go: sh -xc 'some shell command...' to see exactly what the shell is doing with the string you're giving it. All of this before throwing over the net with ssh. Cheers, -- Cameron Simpson <cs@...> DoD#743 http://www.cskk.ezoshosting.com/cs/ No man should escape our universities without knowing how little he knows. - J. Robert Oppenheimer -- fedora-list mailing list fedora-list@... To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines |
|
|
Re: [OT] run command via ssh - problemOn 11/04/2009 05:10 AM, Dan Track wrote:
> Hi, > > I'm running a command like this: > > for i in server1 server2;do ssh root@$i "`hostname`";done. > > However the hostname command always outputs the hostname of the server > that the above command is run from. I'd like to know how to run this > hostname command so that it actually runs on server 1, server2 etc.. > > Thanks > Dan > > Content inside double quotes is evaluated by shell, so backtick expansion happens on localhost. Use single quotes, instead, like so: for i in server1 server2;do ssh root@$i '`hostname`';done HTH -- fedora-list mailing list fedora-list@... To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines |
|
|
Re: [OT] run command via ssh - problemDan Track wrote:
> On Wed, Nov 4, 2009 at 1:33 PM, Bryn M. Reeves <bmr@...> wrote: >> On Wed, 2009-11-04 at 13:13 +0000, Dan Track wrote: >>> On Wed, Nov 4, 2009 at 1:10 PM, Dan Track <dan.track@...> wrote: >>>> Hi, >>>> >>>> I'm running a command like this: >>>> >>>> for i in server1 server2;do ssh root@$i "`hostname`";done. >>>> >>>> However the hostname command always outputs the hostname of the server >>>> that the above command is run from. I'd like to know how to run this >>>> hostname command so that it actually runs on server 1, server2 etc.. >>>> >>>> Thanks >>>> Dan >>>> >>> Sorry just to add the actual script was like this: >>> >>> for i in server1 server2;do ssh root@$i "DNSNAME=\"basename >>> \`hostname\`\";echo $DNSNAME";done >> Not sure why you're setting a variable here but to have "basename" run >> as a command and assign the output to DNSNAME you need to have basename >> inside a pair of backticks too. >> >> You'll then hit another problem because you want to have nested >> backticks (one pair for basename and another for hostname). Bash >> supports '$()' as an alternative to backticks that does allow nesting - >> writing $(hostname) is equivalent to `hostname` and allows you to write >> $(basename $(hostname)). >> >> I'm not sure basename is going to do what you want here though - are you >> looking for the short host name or the domain name? The basename command >> separates components of a path based on the '/' (or whatever the system >> defined path separator is). E.g.: >> >> $ DNS=$(basename $(hostname)) >> $ echo $DNS >> breeves.fab.redhat.com >> >> If you just want the short hostname you can pass -s to hostname: >> >> $ ssh pe1950-1.gsslab hostname -s >> pe1950-1 >> >> Or the domain with -d: >> >> $ ssh pe1950-1.gsslab hostname -d >> gsslab.fab.redhat.com >> >> Have a look at the man page for hostname for more options. >> >> Regards, >> Bryn. > > Hi Bryn, > > Many thanks. I tried hostname -s but I keep getting the following: > > hostname: Host name lookup failure > > This may be because the hostname's are short already e.g just > "server1" instead of "server1.example.com" > > I've updated teh script to your recommendations but I still get the > local hosts hostname in teh output instead of the remote servers > hostname. Any other thoughts? > > I now run the following: > > for i in server1 server2;do ssh root@$i "DNSNAME=$(basename > $(hostname)$);echo $DNSNAME";done | | what is that? | | need a backslash before the $ > > Thanks > Dan > -- Bill Davidsen <davidsen@...> "We have more to fear from the bungling of the incompetent than from the machinations of the wicked." - from Slashdot -- fedora-list mailing list fedora-list@... To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines |
|
|
Re: [OT] run command via ssh - problemBryn M. Reeves wrote:
> On Wed, 2009-11-04 at 13:32 +0000, Dan Track wrote: >> Hi Bryn, >> >> Many thanks. I tried hostname -s but I keep getting the following: >> >> hostname: Host name lookup failure > > Possibly your resolver on the servers is not configured to search its > own local domain. Add a line like this to /etc/resolv.conf: > > search mylocaldomain.com > > Or, if you configure the resolver via dhcp add a directive on the server > to pass this over to clients. > >> This may be because the hostname's are short already e.g just >> "server1" instead of "server1.example.com" >> >> I've updated teh script to your recommendations but I still get the >> local hosts hostname in teh output instead of the remote servers >> hostname. Any other thoughts? >> >> I now run the following: >> >> for i in server1 server2;do ssh root@$i "DNSNAME=$(basename >> $(hostname)$);echo $DNSNAME";done > > You need to use single quotes instead of double quotes - see the rules > in the bash man page about quote expansion. A single quoted string is > not subject to any expansion by the shell on the client machine but a > double quoted string will be expanded on the client before the ssh > command is executed. > > $ ssh abox 'DNSNAME=$(basename $(hostname));echo $DNSNAME' > abox.example.com > > I still don't think that basename will do what you want here... It's not quotes, it's the backtick. Don't backtick the command, just for i in server1 server2; do ssh root@$i hostname; done Example: [root@prophead ~]# for i in bigdog golem3; do ssh root@$i hostname; done bigdog.hci.com golem3.hci.com In the OP's case, the backtick is being invoked and therefore the host name is being passed as the command to execute on the remote machine: [root@prophead ~]# for i in bigdog golem3; do ssh root@$i "`hostname`"; done bash: prophead.hci.com: command not found bash: prophead.hci.com: command not found See? ---------------------------------------------------------------------- - Rick Stevens, Systems Engineer ricks@... - - AIM/Skype: therps2 ICQ: 22643734 Yahoo: origrps2 - - - - Huked on foniks reely wurked for me! - ---------------------------------------------------------------------- -- fedora-list mailing list fedora-list@... To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines |
|
|
Re: [OT] run command via ssh - problemOn 11/04/2009 11:39 PM, Rick Stevens wrote:
> Bryn M. Reeves wrote: >> On Wed, 2009-11-04 at 13:32 +0000, Dan Track wrote: >>> Hi Bryn, >>> >>> Many thanks. I tried hostname -s but I keep getting the following: >>> >>> hostname: Host name lookup failure >> >> Possibly your resolver on the servers is not configured to search its >> own local domain. Add a line like this to /etc/resolv.conf: >> >> search mylocaldomain.com >> >> Or, if you configure the resolver via dhcp add a directive on the server >> to pass this over to clients. >> >>> This may be because the hostname's are short already e.g just >>> "server1" instead of "server1.example.com" >>> >>> I've updated teh script to your recommendations but I still get the >>> local hosts hostname in teh output instead of the remote servers >>> hostname. Any other thoughts? >>> >>> I now run the following: >>> >>> for i in server1 server2;do ssh root@$i "DNSNAME=$(basename >>> $(hostname)$);echo $DNSNAME";done >> >> You need to use single quotes instead of double quotes - see the rules >> in the bash man page about quote expansion. A single quoted string is >> not subject to any expansion by the shell on the client machine but a >> double quoted string will be expanded on the client before the ssh >> command is executed. >> >> $ ssh abox 'DNSNAME=$(basename $(hostname));echo $DNSNAME' >> abox.example.com >> >> I still don't think that basename will do what you want here... > > It's not quotes, it's the backtick. Don't backtick the command, just Yes, they are quotes (in my example above). They are there to disable shell expansion on the client machine and to ensure the whole command line is sent to the remote system unchanged. > for i in server1 server2; do ssh root@$i hostname; done Read the whole thread :) This was suggested way back but the OP wants to do the nested shell expansion thing. Regards, Bryn. -- fedora-list mailing list fedora-list@... To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines |
|
|
Re: [OT] run command via ssh - problemOn 11/04/2009 09:23 PM, Bill Davidsen wrote:
>> for i in server1 server2;do ssh root@$i "DNSNAME=$(basename >> $(hostname)$);echo $DNSNAME";done > A A > | | > what is that? | That's the closing paren for the nested shell expansion that begins with basename on the line above: $(basename $(hostname)) ^ ^ The uselessness of basename in this situation has been pointed out but the syntax is just fine. > need a backslash before the $ Not if you use single quotes as was already suggested. Regards, Bryn. -- fedora-list mailing list fedora-list@... To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines |
| Free embeddable forum powered by Nabble | Forum Help |