Find the answer to your Linux question:
Results 1 to 5 of 5
Hello guys, Im creatin a bash script for making crontab jobs with ease for a user who dont have a clue.. I dont want the comments o be displayed so ...
  1. #1
    Just Joined!
    Join Date
    May 2007
    Posts
    3

    Bash script

    Hello guys,
    Im creatin a bash script for making crontab jobs with ease for a user who dont have a clue.. I dont want the comments o be displayed so i want something like : if the first character of line is"#" then.. etc.. Of course i can print this result with sed and grep but i want to know in my script whats happening so i can do something else if tha "#" character appears... Any ideas how can i implement this??

  2. #2
    Linux Engineer Freston's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    1,047
    ?

    Eh, the script wont print comments if preceded by #
    Or do I misunderstand your question?

  3. #3
    Just Joined!
    Join Date
    May 2007
    Posts
    3
    I know ways so that the comments wont be displayed, but thats not what i want.. I want to know in my script if the line that i am processing is a comment line or another line.. Is there a way to know this?

  4. #4
    Just Joined!
    Join Date
    May 2007
    Posts
    3
    Ok i solved my problem.. It was so easy though im a newbie shell programmer.. Ok now my problm is that i cant append a single line in the end of the crontab file.. Something like
    crontab -l | sed '$a\Text to be appended' | crontab - gives me an error on my mac.. Has anyone any ideas of how this simple work could managed out..

  5. #5
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    What's the error message? I'm not an amazing sed guy, but the crontab stuff looks right.
    DISTRO=Arch
    Registered Linux User #388732

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...