if statement - bash/sh cron not writing -


Can anyone see what I did wrong here? This is an easy piece of my code that works fine. I have never tested it though. Maybe something just is not working on sh? If the detail opens the crane and looks for a similar line before writing. This prevents the duplicate.

  If ["` crontab-l | grape $ SCRIPT` "\ & gt; ""]; Then (crontab-el; echo "* / 10 * * * * cd / etc / mscript / sh & amp; start.sh"). Crontab - fi   

It does not write anything for the cron if the work within the statement works out to 100% by itself. In any way if the statement is broken.

Here's another way to look at it:

  If ["` crontab -l | grep start.sh` "\ & gt; ""]; Then (crontab-el; echo "* / 10 * * * * cd / etc / mscript / sh & amp; start.sh").  If  statement incorrectly works, then CrossTab - Fi    

Direction: The clause is executed, except if the script is already installed, it can be simplified:

  if! Cronat-l | Grep -q start.sh; Then   

this works because grep sets a proper exit code.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -