0

I made a script to encapsulate the use of rsync. Problem is, the output of stdout is lost, which prevent me from testing it. I know how to redirect to a file, but how can I redirect to the standart output?

myscript.sh

if [ $# = 0 ]
then
    echo "Not enought arg"
    exit 1
else
    rsync -avze ssh --partial --delete root@$1:/home/* /backup/$1
    exit 0
fi

I presume I just have to add > after rsync, but to what?

2
  • 2
    If rsync is producing any output and your script is as you've shown and if you're not redirecting the output of your script, then you should see the output. Commented Mar 5, 2014 at 10:42
  • You were both right, I just didn t noticed that rsync was hanging, but was actually outputting. Commented Mar 5, 2014 at 10:49

1 Answer 1

1

You don't neeed anything, output is automatically sent to stdout.

  • Perhaps you should add -v (verbose) to rsync.
  • Your if syntax is incorrect, you should see an error message. Post actual code.
Sign up to request clarification or add additional context in comments.

1 Comment

Corrected the code, I am using putty and didn t found a easy way to copy paste, I ve been to quick when asking. You were both right, I just didn t noticed that rsync was hanging, but was actually outputting. I ll accept in 5min.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.