Reputation: 451
I have a bash script that does this:
#!/bin/bash
# $1 = database dump
# $2 = mysql connect command
$2 < $1
And that last part prints output to stdout & stderr that I don't want. However, I don't know how best to do a > /dev/null 2>&1
style redirect because of how I'm already doing an input redirection.
Upvotes: 1
Views: 121
Reputation: 10138
The order does not matter. You can put < "$1"
before or after >/dev/null 2>&1
:
"$2" < "$1" >/dev/null 2>&1
"$2" >/dev/null 2>&1 < "$1"
As Charles Duffy pointed out, don't forget to put your $1
and $2
variables inside quotes.
Upvotes: 3