C Board  

Go Back   C Board > Platform Specific Boards > Linux Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 11-27-2004, 10:07 AM   #1
Registered User
 
Join Date: Jan 2004
Posts: 68
Linux Scripting IF Else problem

Hi,

here is my code it keeps giving me an error line 10 syntax error near 'then'
Code:
[
			if[ $choice = 1 ];
			then
				tail +$3 $1 | head -n$4 > $2
			elif[ choice =2 ];
				exit 2
			else
__________________
-Ti22-

Last edited by Ti22; 11-27-2004 at 10:41 AM.
Ti22 is offline   Reply With Quote
Old 11-27-2004, 10:14 AM   #2
and the hat of Jobseeking
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,706
> if[ $choice = 1 ];
A space between if and [ perhaps
Salem is offline   Reply With Quote
Old 11-27-2004, 10:40 AM   #3
Registered User
 
Join Date: Jan 2004
Posts: 68
OMG thx lol what a simple problem sorry to bother u.
__________________
-Ti22-
Ti22 is offline   Reply With Quote
Old 11-27-2004, 10:45 AM   #4
Registered User
 
Join Date: Jan 2004
Posts: 68
another question,

instead of getting the command to overwrite a file how do i get it to append to a file?
__________________
-Ti22-
Ti22 is offline   Reply With Quote
Old 11-27-2004, 11:16 AM   #5
and the hat of Jobseeking
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,706
Using redirection
> overwrites
>> appends
Salem is offline   Reply With Quote
Old 11-27-2004, 11:17 AM   #6
Registered User
 
Join Date: Jan 2004
Posts: 68
Quote:
Originally Posted by Salem
Using redirection
> overwrites
>> appends
cool man thx, as you can tell i am a noob in linux being forced to write a shell script.
__________________
-Ti22-
Ti22 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenGL Linux Line Drawing Problem swanley007 C++ Programming 2 04-03-2006 09:31 AM
Problem with porting of Linux code to Windows, FORTRAN/C. stormlab C Programming 1 10-18-2005 10:20 AM
Dabbling with Linux. Hunter2 Tech Board 21 04-21-2005 04:17 PM
Problem with C++ in linux MelaOS C++ Programming 2 12-28-2003 06:29 AM
Linux modem problem VooDoo Linux Programming 5 08-19-2002 05:34 AM


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


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22