0

I have a script which before being launched checks via pwd if the path upon launch is something specific (say dir/subdir/script)

current_folder=$(pwd | grep dir/subdir/script)
if [ "$current_folder" == "" ]; then
{
echo "something bad"
exit
}
fi

how can this script be launched via crontab? I cannot remove the check with pwd or amend the script content under any circumstance since it's subject to continuous updates that would be replaced

Thanks everyone

1 Answer 1

1

You can specify several commands, separated by ; or &&, as your cron job, for example:

* * * * * cd /some/path && foo

(This will only run foo if the cd was successful.)

1
  • that was what I tried which didn't work at first since in the line I had to add some % chars which then came out need to be escaped when used on a crontab line. Thanks for your help, you were right btw Commented Feb 7, 2017 at 23:56

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.