Skip to main content

All Questions

Tagged with
7 votes
3 answers
675 views

How would you gracefully handle this snippet to allow for spaces in directories?

I have a series of commands, e.g.: ssh -i key 10.10.10.10 mkdir -p "${DEST_PATH}/subdir1" "${DEST_PATH}/subdir2" rsync "${SOURCE_PATH}" "$DEST_HOST:${DEST_PATH}/...
JoeSlav's user avatar
  • 128
1 vote
1 answer
694 views

RemoteCommand with percent signs doesn't work

The following command tmux new -A -s $(date +%Y%m%d%H%M%S) works and starts tmux with a session, named after current datetime (as expected). But if I put the same in ssh config RemoteCommand tmux new ...
Dims's user avatar
  • 3,285
0 votes
1 answer
7k views

I received error "bash: line 1: [: -ne: unary operator expected" after run the below script

This script provides the expected output, but throw the error "bash: line 1: [: -ne: unary operator expected". Techies help to fix this. #!/bin/bash USR="root" # Email SUBJECT="NTP Service Status ...
sri's user avatar
  • 21
0 votes
1 answer
656 views

how to use quotes in sed & ssh?

i cant get this to work in bash/rhel 7: ssh host "sed -i -e \"s/dnl MASQUERADE_AS.*\$/MASQUERADE_AS(\`domain.com\')dnl/\" /etc/mail/sendmail.mc" bash: -c: line 0: unexpected EOF while looking for ...
darchon's user avatar
  • 11
0 votes
2 answers
2k views

Run ssh command without quotes

You can execute a command on a remote server using ssh user@host 'the command' but is there a way to execute the command without quotes? (I am on BSD and using OpenSSH)
Alexander Mills's user avatar
5 votes
3 answers
26k views

Kill remote process via ssh

I have a process that I want to kill remotely. I tried ssh remotehost "kill -9 $(ps -aux | grep foo | grep bar | awk '{print $2}')" but this returns the error kill: usage: kill [-s sigspec | -n ...
chrise's user avatar
  • 231
1 vote
3 answers
602 views

SSH with Command Doesn't Run as an Alias

I have the following command to remote into a local server and tail -f the latest log file for an application that I have. The command works perfectly fine from the command line - ssh user@hostname ...
mattdonders's user avatar
2 votes
3 answers
6k views

Bash Script to remotely collect hostname, IP and host total memory

I am trying to write a scrip that will collect the hostname, IP and total memory installed on remote hosts from a list I feed into the script. The script will collect information from Redhat and ...
user315468's user avatar
2 votes
4 answers
33k views

get output of this command from another server via ssh

I'm trying to ssh into a server and get the system uptime using a specific command but it's failing to execute. this would work locally on almost all unix systems startuptime=`uptime | awk '{print $...
Viktova's user avatar
  • 285
4 votes
1 answer
1k views

Using a function's output (defined locally) inside SSH call

I have created a function function getqueue() { urlqueuename="urlcall" ouput=`curl $urlqueuename` queue=$(echo $ouput | jq -r '.queueName') echo $queue } I am using a ssh call ...
Ajith Sasidharan's user avatar
4 votes
3 answers
7k views

awk in ssh command line complains 'unexpected newline or end of string' How to resolve?

While running the below script had an issue, ^ unexpected newline or end of string How could I resolve this ? [root@emrbldbgdapd2 ~]# ./collectdata.sh collect the data of 10.209.61.124 awk: cmd. ...
Levyle's user avatar
  • 41
15 votes
3 answers
4k views

How do ssh remote command line arguments get parsed

I've seen the questions and answers about needing to double-escape the arguments to remote ssh commands. My question is: Exactly where and when does the second parsing get done? If I run the ...
onlynone's user avatar
  • 636
0 votes
1 answer
213 views

Having trouble with sqlite3 ssh command (I am assuming bad quotes)

The following works great: ssh plxch1035.pdx.xxxxxx.com "sqlite3 /p/hdk/rtl/proj_data/shdk74/fe_data/ipci/ipci.db 'select * from tools'" When I want a specific tool row though: ssh plxch1035.pdx....
mcwilk's user avatar
  • 1
3 votes
4 answers
6k views

Avoid escaping of double quotes

I have some commands I want to execute in a bash script. Now when we use single quotes the variable is taken literal and not the value. So doing e.g. ls "$SOME_DIR" is not the same as ls '$SOME_DIR' ...
Jim's user avatar
  • 10.2k
3 votes
1 answer
727 views

Nested quotes nightmare : sending an e-mail from a remote host

I need to send (from my terminal) an email with attachments from my remote host which I access by ssh. I already know that to do something remotely, I use ssh -p myport [email protected] "...
Ewan Delanoy's user avatar

15 30 50 per page
1
2 3 4 5 6