Linux Scripting IF Else problem

This is a discussion on Linux Scripting IF Else problem within the Linux Programming forums, part of the Platform Specific Boards category; Hi, here is my code it keeps giving me an error line 10 syntax error near 'then' Code: [ if[ ...

  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 09:41 AM.
    -Ti22-

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,687
    > 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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,687
    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, 05:29 AM
  5. Linux modem problem
    By VooDoo in forum Linux Programming
    Replies: 5
    Last Post: 08-19-2002, 05:34 AM

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