Skip to main content
deleted 137 characters in body
Source Link
Unix-Ninja
  • 792
  • 6
  • 6

The use of && is actually a shell operator meant to be interpreted by bash. This will not work in cron. Generally speaking, if you want to run multiple commands in a single cron task, you really should put them in a script.

You shouldn't be placing double-quotes around your statement like that. It's likely to be treated as a literal. If you are truly intent on running them inline, you can do something like the following: bash -c 'whoami && which whoami'

But again, at that point you should really be placing your commands in a shell script.

EDIT:

Also just noticed, you shouldn't be placing double-quotes around your statement like that. It's likely to be treated as a literal.

The use of && is actually a shell operator meant to be interpreted by bash. This will not work in cron. Generally speaking, if you want to run multiple commands in a single cron task, you really should put them in a script.

If you are truly intent on running them inline, you can do something like the following: bash -c 'whoami && which whoami'

But again, at that point you should really be placing your commands in a shell script.

EDIT:

Also just noticed, you shouldn't be placing double-quotes around your statement like that. It's likely to be treated as a literal.

Generally speaking, if you want to run multiple commands in a single cron task, you really should put them in a script.

You shouldn't be placing double-quotes around your statement like that. It's likely to be treated as a literal. If you are truly intent on running them inline, you can do something like the following: bash -c 'whoami && which whoami'

But again, at that point you should really be placing your commands in a shell script.

added 143 characters in body
Source Link
Unix-Ninja
  • 792
  • 6
  • 6

The use of && is actually a shell operator meant to be interpreted by bash. This will not work in cron. Generally speaking, if you want to run multiple commands in a single cron task, you really should put them in a script.

If you are truly intent on running them inline, you can do something like the following: bash -c 'whoami && which whoami'

But again, at that point you should really be placing your commands in a shell script.

EDIT:

Also just noticed, you shouldn't be placing double-quotes around your statement like that. It's likely to be treated as a literal.

The use of && is actually a shell operator meant to be interpreted by bash. This will not work in cron. Generally speaking, if you want to run multiple commands in a single cron task, you really should put them in a script.

If you are truly intent on running them inline, you can do something like the following: bash -c 'whoami && which whoami'

But again, at that point you should really be placing your commands in a shell script.

The use of && is actually a shell operator meant to be interpreted by bash. This will not work in cron. Generally speaking, if you want to run multiple commands in a single cron task, you really should put them in a script.

If you are truly intent on running them inline, you can do something like the following: bash -c 'whoami && which whoami'

But again, at that point you should really be placing your commands in a shell script.

EDIT:

Also just noticed, you shouldn't be placing double-quotes around your statement like that. It's likely to be treated as a literal.

Source Link
Unix-Ninja
  • 792
  • 6
  • 6

The use of && is actually a shell operator meant to be interpreted by bash. This will not work in cron. Generally speaking, if you want to run multiple commands in a single cron task, you really should put them in a script.

If you are truly intent on running them inline, you can do something like the following: bash -c 'whoami && which whoami'

But again, at that point you should really be placing your commands in a shell script.