06-07-2011
Thanks a lot - escaping the $ at least reduced the three occurances to two!
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
hello
I installed expect on my solaris box.
now I want to execute this command on several servers as root (all of them have the same root password):
for i in 1 2 3; do ssh root@"srv"$i" ls /; done;
I want of course to skip these 2 steps:
The authenticity of host 'srv3 (172.21.26.25)'... (4 Replies)
Discussion started by: melanie_pfefer
4 Replies
2. Shell Programming and Scripting
I am trying to write an expect script that trys to telnet, if telnet fails, trys to ssh to a remote network devices.
The script works fine until the following is received :
spawn telnet 10.3.2.24
Trying 10.3.2.24...
telnet: connect to address 10.3.2.24: Connection refused
10.3.2.24 is... (2 Replies)
Discussion started by: popeye
2 Replies
3. Shell Programming and Scripting
So here is what I am trying to do. I have a large # of switches and routers I am trying to log into. Unfortunately some have ssh only, some have telnet only. and some i have never logged into with ssh. I first want it to SSH, if i have never logged into the box it will ask for adding the ssh key. I... (0 Replies)
Discussion started by: ippy98
0 Replies
4. Shell Programming and Scripting
Ok, i don't know if anyone else here have had to deal with something like this before, but here's my situation.
I have about 1000+ servers I need to log into to do something.
What i need to do is to log into each server, go to a certain directory on each of the servers, copy the files that... (3 Replies)
Discussion started by: SkySmart
3 Replies
5. Shell Programming and Scripting
I am using Net::SSH::Expect to connect to the device(iLO) with SSH. After the $ssh->login() I'm able to view the prompt, but not able to send any coommands.
With the putty I can connect to the device and execute the commands without any issues.
Here is the sample script
my $ssh =... (0 Replies)
Discussion started by: hansini
0 Replies
6. Shell Programming and Scripting
I'm trying to write a script using expect. I'd like the script to execute several commands when the ssh succeeds and i want it to exit if the ssh fails. Does this require to define a time out for the ssh command so that if the prompt is back before this defined time the next commands are executed??... (2 Replies)
Discussion started by: Hossam_Nox
2 Replies
7. Shell Programming and Scripting
Hi folks,
What I want to do is to check if there is an instance of running vlc on a remote server, then kill it, and start it again. The code I came up with is:
#!/bin/bash
expectFcn() {
expect -c "
set timeout -1
spawn ssh \"$1@$2\" \"$4\"
match_max 100000
expect {
-re... (2 Replies)
Discussion started by: dukevn
2 Replies
8. Shell Programming and Scripting
How would I write an expect script to automate ssh and what file extention do expect files use? (11 Replies)
Discussion started by: Prodiga1
11 Replies
9. Shell Programming and Scripting
Hi all,
I want to connect to some host with "ssh". I have googled and got some commands of "expect" and "spawn". I was not aware of these commands and tried below script.
$ cat auto.sh
set host xx.xx.xx.xx
set password abcd@1234
set user root
spawn ssh $user@$host
expect "*?assword:*"... (4 Replies)
Discussion started by: divya bandipotu
4 Replies
10. Shell Programming and Scripting
I have write a script which contains
ssh -p 12345 dcplatform@10.125.42.50
ssh 127.0.0.1 -p 5555 "$CMD"
ssh root@$GUEST_IP "$CMD"
before I use public key, it works well, now I want to change to "expect", BUT I don't want to change above code and "parameter position"
I can post a... (1 Reply)
Discussion started by: yanglei_fage
1 Replies
LEARN ABOUT OPENSOLARIS
systemd-escape
SYSTEMD-ESCAPE(1) systemd-escape SYSTEMD-ESCAPE(1)
NAME
systemd-escape - Escape strings for usage in systemd unit names
SYNOPSIS
systemd-escape [OPTIONS...] [STRING...]
DESCRIPTION
systemd-escape may be used to escape strings for inclusion in systemd unit names. The command may be used to escape and to undo escaping of
strings.
The command takes any number of strings on the command line, and will process them individually, one after another. It will output them
separated by spaces to stdout.
By default, this command will escape the strings passed, unless --unescape is passed which results in the inverse operation being applied.
If --mangle is given, a special mode of escaping is applied instead, which assumes the string is already escaped but will escape everything
that appears obviously non-escaped.
For details on the escaping and unescaping algorithms see the relevant section in systemd.unit(5).
OPTIONS
The following options are understood:
--suffix=
Appends the specified unit type suffix to the escaped string. Takes one of the unit types supported by systemd, such as "service" or
"mount". May not be used in conjunction with --template=, --unescape or --mangle.
--template=
Inserts the escaped strings in a unit name template. Takes a unit name template such as foobar@.service. May not be used in conjunction
with --suffix=, --unescape or --mangle.
--path, -p
When escaping or unescaping a string, assume it refers to a file system path. This eliminates leading, trailing or duplicate "/"
characters and rejects "." and ".." path components. This is particularly useful for generating strings suitable for unescaping with
the "%f" specifier in unit files, see systemd.unit(5).
--unescape
Instead of escaping the specified strings, undo the escaping, reversing the operation. May not be used in conjunction with --suffix=,
--template= or --mangle.
--mangle
Like --escape, but only escape characters that are obviously not escaped yet, and possibly automatically append an appropriate unit
type suffix to the string. May not be used in conjunction with --suffix=, --template= or --unescape.
-h, --help
Print a short help text and exit.
--version
Print a short version string and exit.
EXAMPLES
To escape a single string:
$ systemd-escape 'Hallochen, Meister'
Hallxc3xb6chenx2cx20Meister
To undo escaping on a single string:
$ systemd-escape -u 'Hallxc3xb6chenx2cx20Meister'
Hallochen, Meister
To generate the mount unit for a path:
$ systemd-escape -p --suffix=mount "/tmp//waldi/foobar/"
tmp-waldi-foobar.mount
To generate instance names of three strings:
$ systemd-escape --template=systemd-nspawn@.service 'My Container 1' 'containerb' 'container/III'
systemd-nspawn@Myx20Containerx201.service systemd-nspawn@containerb.service systemd-nspawn@container-III.service
EXIT STATUS
On success, 0 is returned, a non-zero failure code otherwise.
SEE ALSO
systemd(1), systemd.unit(5), systemctl(1)
systemd 237 SYSTEMD-ESCAPE(1)