This is the type of question which is very hard to search for! I have a shell script that goes like this: #!/bin/bash./script.fcgi --socket /tmp/fcgi-socket &sleep 2chmod a+w /tmp/fcgi-socketscript.fcgi is a long running programm (a daemon?) and I need to append the & in order to have it run in the background. Beside the fact that I am tired, I need sleep because otherwise the script does not have time to set up the socket before I can chmod it. I wanted to have a one-liner like this: ./script.fcgi --socket /tmp/fcgi-socket & && chmod a+w /tmp/fcgi-socket but I guess it's not possible. And I don't know how to get the script to set the socket with the proper write permissions (that would be for another question). But I was curious: am I missing something about combining & and && or it's really not possible to do what I have in mind?
How to combine & and &&?
shell script