parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to run remote bash scripts with "|", "-" characters in it


From: Hans Schou
Subject: Re: how to run remote bash scripts with "|", "-" characters in it
Date: Fri, 11 Oct 2013 21:00:53 +0200


Explamation point is a problem.

WRONG: echo "Hello, world!"

RIGHT: echo "Hello, world"\!

OR: echo Hello, world\!

Will this work?

#! /bin/bash
cd /dir/logs/pot1/jagger
for f in logs-2013-10-09-*.gz; do
    echo Hello World "|  Hi Hell"\!\!" , | , |"
    zcat $f | /bin/egrep 'TIMEOUT|error' | /bin/egrep GSMTable
done





2013/10/11 p sena <senapati2001@yahoo.com>
Hi,

I have a minimal bash executable script to be run across N hosts. I do it this way

cat hosts.txt |parallel -j 0 -u rsync -Ha /home/user/dirname/hello {}:/home/user/hello \; ssh {} /home/user/hello

hello is a bash script with executable perms for all. The script looks like below-
#!/bin/bash

cd /dir/logs/pot1/jagger
for f in `ls logs-2013-10-09-*.gz`; do
    echo Hello World "|  Hi Hell!! , | , |"
    zcat $f |/bin/grep \\-E 'TIMEOUT|error' |/bin/grep \\-E GSMTable
done;

However I am facing issues from using the pipe symbol (|) in the script. It is not outputtting the expected result; when I run and see on a single host too. How do I make use of pipes (|) within such scripts to be run remotely ? If I put a simple script with "echo hello world" in it only then it works fine. The issue crops up when I make it little complex like making use of "|" and/or "-" or "--" characters in the script. The "-" and "--" are options used with some command line programs.
Thanks in advance
~Ciao.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]