Thread: Linux Scripting IF Else problem

  1. #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
    Last edited by Ti22; 11-27-2004 at 10:41 AM.
    -Ti22-

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > if[ $choice = 1 ];
    A space between if and [ perhaps

  3. #3
    Registered User
    Join Date
    Jan 2004
    Posts
    68
    OMG thx lol what a simple problem sorry to bother u.
    -Ti22-

  4. #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-

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Using redirection
    > overwrites
    >> appends

  6. #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-

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OpenGL Linux Line Drawing Problem
    By swanley007 in forum C++ Programming
    Replies: 2
    Last Post: 04-03-2006, 09:31 AM
  2. Replies: 1
    Last Post: 10-18-2005, 10:20 AM
  3. Dabbling with Linux.
    By Hunter2 in forum Tech Board
    Replies: 21
    Last Post: 04-21-2005, 04:17 PM
  4. Problem with C++ in linux
    By MelaOS in forum C++ Programming
    Replies: 2
    Last Post: 12-28-2003, 06:29 AM
  5. Linux modem problem
    By VooDoo in forum Linux Programming
    Replies: 5
    Last Post: 08-19-2002, 05:34 AM