LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-15-2008, 09:39 AM   #1
hashbangbinbash
Member
 
Registered: Mar 2008
Posts: 106

Rep: Reputation: 16
Problem with my 5 line script


Following on from a question I posted in another thread but should have started my own thread for...

Can you see a problem with this script?

Code:
#!/bin/bash
n=$( date | awk $3);
if [$n =< 7]; then
echo "do the thing";
fi
I can't figure why I get the error: "line 3: 7: No such file or directory", 7 is an integer so why does it think it's supposed to be a file or directory?
 
Old 04-15-2008, 09:49 AM   #2
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,442

Rep: Reputation: 71
I think you want
Code:
#!/bin/bash
n=$( date +%d );
if [ $n -le 7 ]; then
echo "do the thing";
fi
 
Old 04-15-2008, 09:53 AM   #3
hashbangbinbash
Member
 
Registered: Mar 2008
Posts: 106

Original Poster
Rep: Reputation: 16
wow, thanks!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash shell script read file line by line. Darren[UoW] Programming 57 04-17-2016 07:07 PM
script to check the last line in a file is blank line or not naveensankineni Programming 10 03-02-2008 12:13 AM
Problem understanding line in script snowman81 Programming 3 02-09-2008 10:58 PM
How to identify a line and replace another string on that line using Shell script? Sid2007 Programming 10 10-01-2007 09:49 PM
shell script find a line and the next line (grep?) metalx1000 Programming 5 07-24-2007 09:41 PM


All times are GMT -5. The time now is 01:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration