1

I was using & in cshell in the end of a command, in order to execute the command as an independent process from the terminal:

kate filename.txt&

How I should do this in bash?

2 Answers 2

4

The same way. From bash(1):

 If  a  command  is terminated by the control operator &, the shell exe-
 cutes the command in the background in a subshell.  The shell does  not
 wait  for  the command to finish, and the return status is 0.
0

Using & will background the job, but it is still tied to the shell.

The difference you may find between csh and bash with & is with regard to redirecting STDERR.

In csh:

    kate filename.txt >& kateout.log

In bash:

    kate filename.txt > kateout.log 2>&1

If you want the process to survive the parent shell/terminal closing, try "nohup" i.e.:

    nohup kate filename.txt > kateout.log 2>&1

The redirect is optional; if there is output it will go to nohup.out in the current working directory.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .