1

I am trying to run this command from console:

# HTTPDUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1`

But got this error:

Try `cut --help' for more information.

I've tried the answer on this post but is not working for me since commands after (listed below) doesn't properly works.

sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX app/cache app/logs
sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX app/cache app/logs

How I can fix the issue I am having?

ReynierPM
  • 363
  • 1
  • 5
  • 20
  • Are you trying to use a space as separator? (as in ` | cut -d" " -f1`) ? – Hennes Jul 02 '15 at 15:07
  • He's trying to parse the user for http daemon, so I'd say "yes, trying to use space". Why is it not working by using the answer from the other question? what's the value of `$HTTPDUSER` in that case? – Felipe Lema Jul 02 '15 at 15:16
  • 1
    He is trying to use it but does not have it in the post with the broken code. @Rschulze already answered it more verbose. I just pointed at it in an indirect way. (And both `-d\ ` or `-d" "` will work). – Hennes Jul 02 '15 at 19:41

1 Answers1

2

You are missing a space in your cut command.

cut -d\ -f1

should be

cut -d\  -f1

since you are using \ to escape the following space (using space as the delimiter), and arguments are separated by a space, there is a missing space between the -d and -f (for cut it looks like you are trying to use " -f1" as a delimiter, which is more than one character).

RSchulze
  • 179
  • 3