Sponsored Content
Full Discussion: if-statement troubles
Top Forums Shell Programming and Scripting if-statement troubles Post 302341877 by KenJackson on Thursday 6th of August 2009 09:32:41 PM
Old 08-06-2009
You are right, doc.arne. One '=' is enough. In fact, some borne shells don't work with two.

But you need spaces around the equal sign in a comparison.
Code:
if [ $today = $birthday ]

Also, I don't think you want the g flag at the end of the sed expression, in case there happen to be two dates on the line. Although I'm not sure what would happen since you are only printing \1.
Code:
birthday=`echo $line | sed 's/^.*,.*,\(..\/..\)\/.*$/\1/g'`

 

10 More Discussions You Might Find Interesting

1. Programming

compiling troubles

i keep getting the following error with the code segment below when i try to compile the program. The code is from 'defs.h' parse error before '(' parse error before ')' stray '\' in program this is the code segment and the error is on the second line of the segment #define... (1 Reply)
Discussion started by: token
1 Replies

2. UNIX for Dummies Questions & Answers

compariosn troubles...

Hi Guys, I am trying to compare using if, but keep getting some strange results. if ; then keeps creating the file 1 if ; then does not work at all if ; then does not work if ; then does not work if ; then does not work eihter. I am using a ksh, on Solaris (9 Replies)
Discussion started by: jagannatha
9 Replies

3. Programming

Troubles with HPUX

Hello I created an application in c language for HP-UX operative system,and it runs on a 32 bits PARISC processor. My problem is that I have to run this same application but now in a 64 bits Parisc processor. But I am not able to compile the application with the 64 bit server, and I only could use... (1 Reply)
Discussion started by: masterboy6666
1 Replies

4. UNIX for Dummies Questions & Answers

Password Troubles

I'm very new to UNIX (I just started working with Terminal 2 days ago) and I don't know the system very well. I'm having trouble whenever I am asked for a password. I simply... can't type. I press keys on the keyboard but no characters appear on the screen. For example, when I log onto... (5 Replies)
Discussion started by: alexmiller
5 Replies

5. UNIX for Dummies Questions & Answers

ssh2 troubles

I'm trying to set up a secure and trusted connection between 2 boxes running solaris using ssh2. I've run ssh-keygen2 on the local box and on the remote box, created the identification file ( IdKey id_dsa_2048_a ) on the local machine and copied across the public key file from the local to... (5 Replies)
Discussion started by: PaulC
5 Replies

6. Shell Programming and Scripting

Encoding troubles

Hello All I have a set of files, each one containing some lines that follows that regex: regex='disabled\,.*\,\".*\"'and here is what file says about each files: file <random file> <random file> ASCII text, with CRLF line terminatorsSo, as an example, here is what a file ("Daffy Duck - The... (3 Replies)
Discussion started by: tukuyomi
3 Replies

7. UNIX for Dummies Questions & Answers

Cron troubles

I am aware this question has been answered time and again. I feel I have tried everything I have seen on the net and really need help to get this working. Same old story. Shell script, working from command but not from cron. I need my script to take values from a .properties file. Tried... (2 Replies)
Discussion started by: airalpha
2 Replies

8. Shell Programming and Scripting

for loop troubles

What I have here is a pretty textbook recursive function. Its purpose right now is simply to display all folders that don't contain folders. It works fine in all instances I can think of... except one. If there is a folder with a space in its name, the thing goes Kablooie. AFAIK the problem comes... (5 Replies)
Discussion started by: divisionbyzero
5 Replies

9. BSD

PF troubles on OpenBSD 5.0

I am setting up a system as an ADSL gateway. ADSL is working fine. PF is not forwarding for some reason. # ifconfig lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33196 priority: 0 groups: lo inet6... (0 Replies)
Discussion started by: John Tate
0 Replies

10. Shell Programming and Scripting

Case Statement Troubles

Hi, I'm attempting to create case statement in a ksh script that does the following: Run a uname command against the box and use that value for $HOSTNAME object. Then, if hostname has AIX in it, then use the lsldap command to try to bind, then print $HOSTNAME:yes or $HOSTNAME:no, depending on... (7 Replies)
Discussion started by: tekster2
7 Replies
CAL(1)								   User Commands							    CAL(1)

NAME
cal - display a calendar SYNOPSIS
cal [options] [[[day] month] year] DESCRIPTION
cal displays a simple calendar. If no arguments are specified, the current month is displayed. OPTIONS
-1, --one Display single month output. (This is the default.) -3, --three Display prev/current/next month output. -s, --sunday Display Sunday as the first day of the week. -m, --monday Display Monday as the first day of the week. -j, --julian Display Julian dates (days one-based, numbered from January 1). -y, --year Display a calendar for the current year. -V, --version Display version information and exit. -h, --help Display help screen and exit. PARAMETERS
A single parameter specifies the year (1 - 9999) to be displayed; note the year must be fully specified: cal 89 will not display a calendar for 1989. Two parameters denote the month (1 - 12) and year. Three parameters denote the day (1-31), month and year, and the day will be highlighted if the calendar is displayed on a terminal. If no parameters are specified, the current month's calendar is displayed. A year starts on Jan 1. The first day of the week is determined by the locale. The Gregorian Reformation is assumed to have occurred in 1752 on the 3rd of September. By this time, most countries had recognized the ref- ormation (although a few did not recognize it until the early 1900's). Ten days following that date were eliminated by the reformation, so the calendar for that month is a bit unusual. HISTORY
A cal command appeared in Version 6 AT&T UNIX. AVAILABILITY
The cal command is part of the util-linux package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux/. util-linux June 2011 CAL(1)
All times are GMT -4. The time now is 04:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy