0

On RHEL, the below command works: psql -h hostname -U username -p port_no -d database -f /tmp/myfile.sql &> logfile01.txt

On FreeBSD, this throws error: "Invalid null command"

Please suggest.

1

2 Answers 2

2

If you use this only on the command line then there is no need to change the shell. To redirect stdout and stderr to a file in C-Shell synthax simply use ">& filename".

Different story is, if you want to write shell scripts. Bourne Shell and it's clones (like i.e. Bash) are better suited for writing script. See this Unix FAQ "Csh Programming Considered Harmful": http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/

Sign up to request clarification or add additional context in comments.

Comments

0

This redirection works in bash

&> logfile01.txt

, but it does not work in csh which is the default shell in FreeBSD.

# set | grep shell
shell   /bin/csh
# ls -la &> logfile01.txt
Invalid null command.

Bash is not installed by default. You can install it

pkg install bash

and configure it as the default shell.

Comments

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.