Jamie
Jamie

Reputation: 7431

Is there a `sh` equivalent to bash's `<<<' redirection operator?

I'm trying to execute an at command from a cgi script. The script is executed as the default Apache2 user on Ubuntu (www-data) but the default shell is /bin/sh and not bash. Aside from security issues of running at as www-data (see my other question), I could change the default shell, but I'm wondering, is there a more portable way to write this bash friendly command?

at now + 5 minutes <<< 'python my_script.py data_arg'

Upvotes: 8

Views: 3938

Answers (2)

chepner
chepner

Reputation: 531808

<<< is also just a shortcut for a single-line here document.

at now + 5 minutes <<EOF
python my_script.py data_arg
EOF

Upvotes: 5

John Kugelman
John Kugelman

Reputation: 361879

echo 'python my_script.py data_arg' | at now + 5 minutes

Upvotes: 6

Related Questions