Find the answer to your Linux question:
Results 1 to 9 of 9
Why do I get the error: line 189: unexpected EOF while looking for matching `"' line 190: unexpected enf of the file. In this script.. Code: #!bin/bash/ #Make a New ...
  1. #1
    Linux Engineer RobinVossen's Avatar
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    1,422

    Bash: unexpected end of file

    Why do I get the error:
    line 189: unexpected EOF while looking for matching `"'
    line 190: unexpected enf of the file.
    In this script..
    Code:
    #!bin/bash/
    #Make a New Chrooted User Script.
    #Version 0.4
    clear
    echo "##########################"
    echo "##       WARNING!       ##"
    echo "##                      ##"
    echo "##DO NOT RUN THIS SCRIPT##"
    echo "##   IF YOU ARNT ROOT   ##"
    echo "## OR if you DONT want  ##"
    echo "##     A new user..     ##"
    echo "##                      ##"
    echo "##ABORT NOW IF YOU DONT ##"
    echo "##WANT TO ADD A NEW USER##"
    echo "## OR ARE NOT THE ROOT  ##"
    echo "##                      ##"
    echo "## IF THE USER ALREADY  ##"
    echo "##   EXIST YOU MIGHT    ##"
    echo "##  SCREW UP BIG-TIME   ##"
    echo "##                      ##"
    echo "##########################"
    echo 
    echo
    echo 
    ##Start with Script
    echo "Name of the user:"
    read NEWUSER
    
    ##Make User##
    adduser $NEWUSER #Add check for and answer 0 (Success)
    passwd $NEWUSER
    
    #Make Temp folder
    mkdir /home/$NEWUSER/tmp
    chmod 777 /home/$NEWUSER/tmp
    chmod +t /home/$NEWUSER/tmp
    
    ##Make ChrootJail##
    echo "# .bashrc" > /home/$NEWUSER/.bashrc
    echo "" >> /home/$NEWUSER/.bashrc #Whiteline 
    echo "# Source global definitions" >> /home/$NEWUSER/.bashrc
    echo "if [ -f /etc/bashrc ]; then" >> /home/$NEWUSER/.bashrc
    echo "          . /etc/bashrc" >> /home/$NEWUSER/.bashrc
    echo "fi" >> /home/$NEWUSER/.bashrc
    echo "" >> /home/$NEWUSER/.bashrc #Empty line
    echo "#ChrootJail" >> /home/$NEWUSER/.bashrc
    
    #Draw Warning for a User who is able to get into Console.
    #Hope that will Scare them off...
    echo "" >> /home/$NEWUSER/.bashrc
    echo "" >> /home/$NEWUSER/.bashrc
    echo "" >> /home/$NEWUSER/.bashrc
    echo "     Warning!" >> /home/$NEWUSER/.bashrc
    echo "echo \"    _,,   ,,_\"" >> /home/$NEWUSER/.bashrc
    echo "echo \"  \~\(  \"o o\"  \)\~\"" >> /home/$NEWUSER/.bashrc
    echo "echo \"   ,,,,   ,,,,\"" >> /home/$NEWUSER/.bashrc
    echo "Warn the system admin..!" >> /home/$NEWUSER/.bashrc
    echo "" >> /home/$NEWUSER/.bashrc
    echo "" >> /home/$NEWUSER/.bashrc
    #I should out something here to Hide the Bash
    #So People CANT run the Bash, they will just be Kicked out..
    #exit (STILL HAVE THE TEST THIS
    #Lets hope that exit works...
    chown $NEWUSER /home/$NEWUSER/.bashrc
    
    ##Write User in sudoers Files##
    
    ##TO BE DONE!!
    echo "-----------------------------------------"
    echo "DONT FORGET TO PUT USER IN SUDOERS FILE"
    echo "SINCE THIS SCRIPT DOESNT DO THAT STILL.."
    echo "         nano -w /etc/sudoers"
    echo "-----------------------------------------"
    nano -w /etc/sudoers #TEMP SOL, FIND BETTER ONE LATER ON
    
    ##Write Fluxbox Start File
    #First make the workdir
    mkdir /home/$NEWUSER/.fluxbox/
    #Execute: fbdesk, ChrootJailScript
    echo "##mkdir" >> /home/$NEWUSER/.fluxbox/startup
    echo "mkdir /home/$NEWUSER/lib"  >> /home/$NEWUSER/.fluxbox/startup
    echo "mkdir /home/$NEWUSER/dev"  >> /home/$NEWUSER/.fluxbox/startup
    echo "mkdir /home/$NEWUSER/bin"  >> /home/$NEWUSER/.fluxbox/startup
    echo "mkdir /home/$NEWUSER/etc"  >> /home/$NEWUSER/.fluxbox/startup
    echo "mkdir /home/$NEWUSER/usr"  >> /home/$NEWUSER/.fluxbox/startup
    echo "mkdir /home/$NEWUSER/var"  >> /home/$NEWUSER/.fluxbox/startup
    echo "mkdir /home/$NEWUSER/sys"  >> /home/$NEWUSER/.fluxbox/startup
    echo "mkdir /home/$NEWUSER/sbin" >> /home/$NEWUSER/.fluxbox/startup
    
    #Mount the System for the user. This shouldnt be only read Only.
    #We really have to Figure out what can be read only and what has to be read-only
    #Then also the dirs that we dont need completely but just a small part Copy
    #All the files that are needed. I think I need to do it that way since well 
    #They they dont have the Shadow File.. And it is more secure.
    #If there is one folder mounted with Read/Write people can just
    #Send files to each other in that way.. That shouldnt be allowed..
    #So, Read-Only as much as possible.
    #    Copy Files when a Folder needs less then 50 files to be ReadWrite that arnt System files.
    #    Read-Write were needed. To make it just work.
    echo "sudo /bin/mount -r -o bind /lib /home/$NEWUSER/lib"   >> /home/$NEWUSER/.fluxbox/startup
    echo "sudo /bin/mount -r -o bind /dev /home/$NEWUSER/dev"   >> /home/$NEWUSER/.fluxbox/startup
    echo "sudo /bin/mount -r -o bind /bin /home/$NEWUSER/bin"   >> /home/$NEWUSER/.fluxbox/startup
    echo "sudo /bin/mount -r -o bind /tmp /home/$NEWUSER/usr"   >> /home/$NEWUSER/.fluxbox/startup
    echo "sudo /bin/mount    -o bind /var /home/$NEWUSER/var"   >> /home/$NEWUSER/.fluxbox/startup
    echo "sudo /bin/mount -r -o bind /sys /home/$NEWUSER/sys"   >> /home/$NEWUSER/.fluxbox/startup
    echo "sudo /bin/mount -r -o bind /sbin /home/$NEWUSER/sbin" >> /home/$NEWUSER/.fluxbox/startup
    ##echo "sudo /bin/mount    -o bind /tmp /home/$NEWUSER/tmp"   >> /home/$NEWUSER/.fluxbox/startup
    #Make a Custom etc folder for each user
    #Since of the passwd and shadow file..
    echo "sudo /bin/mount -r -o bind /etc /home/$NEWUSER/etc >> /home/$NEWUSER/.fluxbox/startup
    grep root /etc/passwd > /home/$NEWUSER/etc/passwd
    grep $NEWUSER >> /home/$NEWUSER/etc/passwd
    
    echo "" >> /home/$NEWUSER/.fluxbox/startup #Empty
    echo "sudo /usr/sbin/chroot /home/$NEWUSER" >> /home/$NEWUSER/.fluxbox/startup
    
    echo "fbdesk &" >> /home/$NEWUSER/.fluxbox/startup
    echo "#The Following Line MUST be the last one." >> /home/$NEWUSER/.fluxbox/startup
    echo "exec /usr/bin/fluxbox -log /home/$NEWUSER/.fluxbox/log" >> /home/$NEWUSER/.fluxbox/startup
    
    
    ##Make LoginFiles##
    #Set change password at next login
    #Number is set to 1 so there can be logged in once.
    chage -d 1 $NEWUSER
    
    #Copy Fluxbox menu file
    #cp /usr/share/fluxbox/menu /home/$NEWUSER/.fluxbox/menu
    echo "Edit this users Menu, Press the \"enter\" key to Continue"
    read
    vi /home/$NEWUSER/.fluxbox/menu
    chown $NEWUSER /home/$NEWUSER/.fluxbox/menu
    
    #HAS TO BE CHANGED, ADD MORE SYSTEMS
    #Write Desktop ~ Icon Files
    echo "" > /home/$NEWUSER/.fluxbox/fbdesk.icons
    echo "[Desktop Entry]" >> /home/$NEWUSER/.fluxbox/fbdesk.icons
    echo "Name=Firefox" >> /home/$NEWUSER/.fluxbox/fbdesk.icons
    echo "Exec=/usr/share/menuscripts/firefox" >> /home/$NEWUSER/.fluxbox/fbdesk.icons 
    echo "Icon=/usr/share/pixmaps/firefox.png" >> /home/$NEWUSER/.fluxbox/fbdesk.icons 
    echo "Pos= 344 70" >> /home/$NEWUSER/.fluxbox/fbdesk.icons 
    echo "[end]" >> /home/$NEWUSER/.fluxbox/fbdesk.icons 
    echo "" >> /home/$NEWUSER/.fluxbox/fbdesk.icons
    echo "[Desktop Entry]" >> /home/$NEWUSER/.fluxbox/fbdesk.icons
    echo "Name=Thunderbird" >> /home/$NEWUSER/.fluxbox/fbdesk.icons
    echo "Exec=/usr/share/menuscripts/thunderbird" >> /home/$NEWUSER/.fluxbox/fbdesk.icons 
    echo "Icon=/usr/share/pixmaps/thunderbird.png" >> /home/$NEWUSER/.fluxbox/fbdesk.icons 
    echo "Pos= 344 70" >> /home/$NEWUSER/.fluxbox/fbdesk.icons 
    echo "[end]" >> /home/$NEWUSER/.fluxbox/fbdesk.icons 
    
    #Write CleanUp in /home/$NEWUSER/.bash_logout
    echo "# ~/.bash_logout" > /home/$NEWUSER/.bash_logout
    echo ""   >> /home/$NEWUSER/.bash_logout #Blank Line
    echo "clear"   >> /home/$NEWUSER/.bash_logout
    echo "sudo /bin/umount /home/$NEWUSER"   >> /home/$NEWUSER/.bash_logout
    
    #DIRS YOU WANT TO KILL, This is Cleaning up to avoid Error Msgs.
    #Also to save Memory
    echo "rm -rf /home/$NEWUSER/lib"   >> .bash_logout  
    echo "rm -rf /home/$NEWUSER/dev"   >> .bash_logout  
    echo "rm -rf /home/$NEWUSER/bin"   >> .bash_logout  
    echo "rm -rf /home/$NEWUSER/etc"   >> .bash_logout  
    echo "rm -rf /home/$NEWUSER/usr"   >> .bash_logout  
    echo "rm -rf /home/$NEWUSER/tmp"   >> .bash_logout 
    echo "rm -rf /home/$NEWUSER/var"   >> .bash_logout  
    echo "rm -rf /home/$NEWUSER/sys"   >> .bash_logout  
    echo "rm -rf /home/$NEWUSER/sbin"  >> .bash_logout 
    chown $NEWUSER /home/$NEWUSER/.bash_logout $NEWUSER
    
    #Write /home/$NEWUSER/.dmrc, so that Login with Fluxbox just works
    #But this Doesnt work yet..
    echo "[Desktop]" > /home/$NEWUSER/.dmrc
    echo "Session=fluxbox" >> /home/$NEWUSER/.dmrc
    chown $NEWUSER /home/$NEWUSER/.dmrc
    
    
    echo "-------------------------------------"
    echo "WRITE USER IN DEFAULT SESSION TYPE"
    echo "THIS DOESNT WORK YET WITH THIS SCRIPT"
    echo "MAKE DEFUALT: FLUXBOX"
    echo "IT SHOULD WORK, SCAN WHY IT DOESNT.."
    echo "-------------------------------------"
    
    #Done, Draw end of Script.
    echo "  " #Bare Line
    echo "New User is Made.."
    echo "Be sure that it works before the user gets access"
    echo "WARNING, LOGIN ONCE.. The Second Time the Password"
    
    echo "Has to be Changed. Its the best if the user changes"
    echo "it. Since they have a feeling of Safety then..."
    The Red lines are they were the error points to.
    The Blue Part is that I know for sure that is executed.
    And all the Green Parts of echo I havnt seen in the terminal were I execute this script.
    New Users, please read this..
    Google first, then ask..

  2. #2
    Linux Newbie radoulov's Avatar
    Join Date
    Sep 2007
    Posts
    111
    Change:

    Code:
    echo "sudo /bin/mount -r -o bind /etc /home/$NEWUSER/etc  >>
    to

    Code:
    echo "sudo /bin/mount -r -o bind /etc /home/$NEWUSER/etc"  >>

  3. #3
    Linux Engineer RobinVossen's Avatar
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    1,422
    Damn, typo..
    And then I am using gedit. So I have Syntax Hilightning and I still keep looking over it.
    I have been searching for over half an hour for such mistakes...

    Thanks -.-'

    Ok, the Script runs now..
    But I get errors afterwards.
    Here is the current script:
    Code:
    #!bin/bash/
    #Make a New Chrooted User Script.
    #Version 0.4
    clear
    echo "##########################"
    echo "##       WARNING!       ##"
    echo "##                      ##"
    echo "##DO NOT RUN THIS SCRIPT##"
    echo "##   IF YOU ARNT ROOT   ##"
    echo "## OR if you DONT want  ##"
    echo "##     A new user..     ##"
    echo "##                      ##"
    echo "##ABORT NOW IF YOU DONT ##"
    echo "##WANT TO ADD A NEW USER##"
    echo "## OR ARE NOT THE ROOT  ##"
    echo "##                      ##"
    echo "## IF THE USER ALREADY  ##"
    echo "##   EXIST YOU MIGHT    ##"
    echo "##  SCREW UP BIG-TIME   ##"
    echo "##                      ##"
    echo "##########################"
    echo 
    echo
    echo 
    ##Start with Script
    echo "Name of the user:"
    read NEWUSER
    
    ##Make User##
    adduser $NEWUSER #Add check for and answer 0 (Success)
    passwd $NEWUSER
    
    #Make Temp folder
    mkdir /home/$NEWUSER/tmp
    chmod 777 /home/$NEWUSER/tmp
    chmod +t /home/$NEWUSER/tmp
    
    ##Make ChrootJail##
    echo "# .bashrc" > /home/$NEWUSER/.bashrc
    echo "" >> /home/$NEWUSER/.bashrc #Whiteline 
    echo "# Source global definitions" >> /home/$NEWUSER/.bashrc
    echo "if [ -f /etc/bashrc ]; then" >> /home/$NEWUSER/.bashrc
    echo "          . /etc/bashrc" >> /home/$NEWUSER/.bashrc
    echo "fi" >> /home/$NEWUSER/.bashrc
    echo "" >> /home/$NEWUSER/.bashrc #Empty line
    echo "#ChrootJail" >> /home/$NEWUSER/.bashrc
    
    #Draw Warning for a User who is able to get into Console.
    #Hope that will Scare them off...
    echo "" >> /home/$NEWUSER/.bashrc
    echo "" >> /home/$NEWUSER/.bashrc
    echo "" >> /home/$NEWUSER/.bashrc
    echo "echo \"     Warning!\"" >> /home/$NEWUSER/.bashrc
    echo "echo \"    _,,   ,,_\"" >> /home/$NEWUSER/.bashrc
    echo "echo \"  \~\(  \"o o\"  \)\~\"" >> /home/$NEWUSER/.bashrc
    echo "echo \"   ,,,,   ,,,,\"" >> /home/$NEWUSER/.bashrc
    echo "echo \"Warn the system admin..!\"" >> /home/$NEWUSER/.bashrc
    echo "" >> /home/$NEWUSER/.bashrc
    echo "" >> /home/$NEWUSER/.bashrc
    #I should out something here to Hide the Bash
    #So People CANT run the Bash, they will just be Kicked out..
    #exit (STILL HAVE THE TEST THIS)
    #Lets hope that exit works...
    chown $NEWUSER /home/$NEWUSER/.bashrc
    
    ##Write User in sudoers Files##
    
    ##TO BE DONE!!
    echo "-----------------------------------------"
    echo "DONT FORGET TO PUT USER IN SUDOERS FILE"
    echo "SINCE THIS SCRIPT DOESNT DO THAT STILL.."
    echo "         nano -w /etc/sudoers"
    echo "-----------------------------------------"
    nano -w /etc/sudoers #TEMP SOL, FIND BETTER ONE LATER ON
    
    ##Write Fluxbox Start File
    #First make the workdir
    mkdir /home/$NEWUSER/.fluxbox/
    #Execute: fbdesk, ChrootJailScript
    echo "##mkdir" >> /home/$NEWUSER/.buildchroot
    echo "mkdir /home/$NEWUSER/lib"  >> /home/$NEWUSER/.buildchroot
    echo "mkdir /home/$NEWUSER/dev"  >> /home/$NEWUSER/.buildchroot
    echo "mkdir /home/$NEWUSER/bin"  >> /home/$NEWUSER/.buildchroot
    echo "mkdir /home/$NEWUSER/etc"  >> /home/$NEWUSER/.buildchroot
    echo "mkdir /home/$NEWUSER/usr"  >> /home/$NEWUSER/.buildchroot
    echo "mkdir /home/$NEWUSER/var"  >> /home/$NEWUSER/.buildchroot
    echo "mkdir /home/$NEWUSER/sys"  >> /home/$NEWUSER/.buildchroot
    echo "mkdir /home/$NEWUSER/sbin" >> /home/$NEWUSER/.buildchroot
    
    #Mount the System for the user. This shouldnt be only read Only.
    #We really have to Figure out what can be read only and what has to be read-only
    #Then also the dirs that we dont need completely but just a small part Copy
    #All the files that are needed. I think I need to do it that way since well 
    #They they dont have the Shadow File.. And it is more secure.
    #If there is one folder mounted with Read/Write people can just
    #Send files to each other in that way.. That shouldnt be allowed..
    #So, Read-Only as much as possible.
    #    Copy Files when a Folder needs less then 50 files to be ReadWrite that arnt System files.
    #    Read-Write were needed. To make it just work.
    echo "sudo /bin/mount -r -o bind /lib /home/$NEWUSER/lib"   >> /home/$NEWUSER/.buildchroot
    echo "sudo /bin/mount -r -o bind /dev /home/$NEWUSER/dev"   >> /home/$NEWUSER/.buildchroot
    echo "sudo /bin/mount -r -o bind /bin /home/$NEWUSER/bin"   >> /home/$NEWUSER/.buildchroot
    echo "sudo /bin/mount -r -o bind /tmp /home/$NEWUSER/usr"   >> /home/$NEWUSER/.buildchroot
    echo "sudo /bin/mount    -o bind /var /home/$NEWUSER/var"   >> /home/$NEWUSER/.buildchroot
    echo "sudo /bin/mount -r -o bind /sys /home/$NEWUSER/sys"   >> /home/$NEWUSER/.buildchroot
    echo "sudo /bin/mount -r -o bind /sbin /home/$NEWUSER/sbin" >> /home/$NEWUSER/.buildchroot
    #Make a Custom etc folder for each user
    #Since of the passwd and shadow file..
    echo "sudo /bin/mount -r -o bind /etc /home/$NEWUSER/etc" >> /home/$NEWUSER/.buildchroot
    #grep root /etc/passwd > /home/$NEWUSER/etc/passwd
    #grep $NEWUSER >> /home/$NEWUSER/etc/passwd
    #Now wrote to the .buildchroot file.
    #Now it has to add everytime when open a bash (all progs will be started with a chroot)
    #Check for already chrooted. if not (sh .buildchroot)
    
    echo "" >> /home/$NEWUSER/.buildchroot #Empty
    echo "sudo /usr/sbin/chroot /home/$NEWUSER" >> /home/$NEWUSER/.buildchroot
    
    
    echo "fbdesk &" >> /home/$NEWUSER/.fluxbox/startup
    echo "#The Following Line MUST be the last one." >> /home/$NEWUSER/.fluxbox/startup
    echo "exec /usr/bin/fluxbox -log /home/$NEWUSER/.fluxbox/log" >> /home/$NEWUSER/.fluxbox/startup
    
    
    ##Make LoginFiles##
    #Set change password at next login
    #Number is set to 1 so there can be logged in once.
    chage -d 1 $NEWUSER
    
    #Copy Fluxbox menu file
    #cp /usr/share/fluxbox/menu /home/$NEWUSER/.fluxbox/menu
    echo "Edit this users Menu, Press the \"enter\" key to Continue"
    read
    nano -w  /home/$NEWUSER/.fluxbox/menu
    chown $NEWUSER /home/$NEWUSER/.fluxbox/menu
    
    #HAS TO BE CHANGED, ADD MORE SYSTEMS
    #Write Desktop ~ Icon Files
    echo "" > /home/$NEWUSER/.fluxbox/fbdesk.icons
    echo "[Desktop Entry]" >> /home/$NEWUSER/.fluxbox/fbdesk.icons
    echo "Name=Firefox" >> /home/$NEWUSER/.fluxbox/fbdesk.icons
    echo "Exec=/usr/share/menuscripts/firefox" >> /home/$NEWUSER/.fluxbox/fbdesk.icons 
    echo "Icon=/usr/share/pixmaps/firefox.png" >> /home/$NEWUSER/.fluxbox/fbdesk.icons 
    echo "Pos= 344 70" >> /home/$NEWUSER/.fluxbox/fbdesk.icons 
    echo "[end]" >> /home/$NEWUSER/.fluxbox/fbdesk.icons 
    echo "" >> /home/$NEWUSER/.fluxbox/fbdesk.icons
    echo "[Desktop Entry]" >> /home/$NEWUSER/.fluxbox/fbdesk.icons
    echo "Name=Thunderbird" >> /home/$NEWUSER/.fluxbox/fbdesk.icons
    echo "Exec=/usr/share/menuscripts/thunderbird" >> /home/$NEWUSER/.fluxbox/fbdesk.icons 
    echo "Icon=/usr/share/pixmaps/thunderbird.png" >> /home/$NEWUSER/.fluxbox/fbdesk.icons 
    echo "Pos= 344 70" >> /home/$NEWUSER/.fluxbox/fbdesk.icons 
    echo "[end]" >> /home/$NEWUSER/.fluxbox/fbdesk.icons 
    
    #Write CleanUp in /home/$NEWUSER/.bash_logout
    echo "# ~/.bash_logout" > /home/$NEWUSER/.bash_logout
    echo ""   >> /home/$NEWUSER/.bash_logout #Blank Line
    echo "clear"   >> /home/$NEWUSER/.bash_logout
    echo "sudo /bin/umount /home/$NEWUSER"   >> /home/$NEWUSER/.bash_logout
    
    #DIRS YOU WANT TO KILL, This is Cleaning up to avoid Error Msgs.
    #Also to save Memory
    echo "rm -rf /home/$NEWUSER/lib"   >> .bash_logout  
    echo "rm -rf /home/$NEWUSER/dev"   >> .bash_logout  
    echo "rm -rf /home/$NEWUSER/bin"   >> .bash_logout  
    echo "rm -rf /home/$NEWUSER/etc"   >> .bash_logout  
    echo "rm -rf /home/$NEWUSER/usr"   >> .bash_logout  
    echo "rm -rf /home/$NEWUSER/tmp"   >> .bash_logout 
    echo "rm -rf /home/$NEWUSER/var"   >> .bash_logout  
    echo "rm -rf /home/$NEWUSER/sys"   >> .bash_logout  
    echo "rm -rf /home/$NEWUSER/sbin"  >> .bash_logout 
    chown $NEWUSER /home/$NEWUSER/.bash_logout $NEWUSER
    
    #Write /home/$NEWUSER/.dmrc, so that Login with Fluxbox just works
    #But this Doesnt work yet..
    echo "[Desktop]" > /home/$NEWUSER/.dmrc
    echo "Session=fluxbox" >> /home/$NEWUSER/.dmrc
    chown $NEWUSER /home/$NEWUSER/.dmrc
    
    #Done, Draw end of Script.
    echo "  " #Bare Line
    echo "New User is Made.."
    echo "Be sure that it works before the user gets access"
    echo "WARNING, LOGIN ONCE.. The Second Time the Password"
    echo "Has to be Changed. Its the best if the user changes"
    echo "it. Since they have a feeling of Safety then..."
    And I get a error, that I cant copy.
    and its not saved in a file (it says its saved to /home/user/.xsessionerrors but that file isnt there when I login with root.
    (I know its hidden)
    Well, if anyone sees the error id be glad.
    I think you wont since I dont give enough information.. :/ (though I cant give more..)
    New Users, please read this..
    Google first, then ask..

  4. #4
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    I have two suggestions.

    First, be more specific than
    I get a error, that I cant copy
    Copy and paste into this thread the exact text of the error message. Don't paraphrase it, and don't type the error message by hand. Copy and paste.

    Second, if nothing else works, make another copy of your script. Then remove as much from your script as you can, without making the bad behavior go away.

    Then post that much shorter script here, and post along with that the error message you get when you run that shorter script.

  5. #5
    Linux Engineer RobinVossen's Avatar
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    1,422
    Quote Originally Posted by wje_lf View Post
    I have two suggestions.
    First, be more specific than
    Copy and paste into this thread the exact text of the error message. Don't paraphrase it, and don't type the error message by hand. Copy and paste.
    Well thats the Problem. I CANT copy the error.
    Since I when I select it and press Cntrl + C. I dont have a place to Paste it.
    And when I get a place to Paste it again the Clipboard is empty.. So I cant copy paste..

    Quote Originally Posted by wje_lf View Post
    Second, if nothing else works, make another copy of your script. Then remove as much from your script as you can, without making the bad behavior go away.
    So you want me to remove all the Comments?
    And then you think its more clear?
    And What do you mean with
    Quote Originally Posted by wje_lf View Post
    without making the bad behavior go away.
    I try to be kind here and I never want to make make a mass here. There is a reason why I edit my posts since then I dont spam alot Anywho sorry If I made you feel bad course of my post.
    New Users, please read this..
    Google first, then ask..

  6. #6
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Sorry. My bad. I wasn't explicit enough.

    When I said "copy and paste it here" I meant that you should reply to this thread, and in your reply, copy and paste your simplified program, exactly as you did in the first post of this thread.

    And by simplify your program, I don't just mean removing comments. I mean making the program as small and simple as possible without getting rid of the error message, without getting rid of the misbehavior that you see.

    Let's take the following obvious example of a misbehaving script.

    Code:
    #!/bin/bash
    
    DIVISOR=0
    
    echo -n "Enter a number: "
    
    read
    
    if [[ $REPLY -gt 5 ]]
    then
      REPLY=$((2*$REPLY))
    fi
    
    REPLY=$(($REPLY/$DIVISOR))
    
    echo $REPLY
    If you run it, you get something like this error which I copied and pasted into this post:
    Code:
    ./1.sh: line 14: 12/0: division by 0 (error token is "0")
    You can eliminate much of that code and still get the error:
    Code:
    #!/bin/bash
    
    DIVISOR=0
    
    REPLY=39
    
    REPLY=$(($REPLY/$DIVISOR))
    So do the same to your script. Simplify it as much as possible without making the error message go away. When you copy and paste the simplified code into a reply to this thread, be sure to copy and paste the error message you get also. Then we can understand more easily what's going on.

  7. #7
    Linux Engineer RobinVossen's Avatar
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    1,422
    Ah ok I thought you ment alot diffrent things.
    Well I think I cant really make it smaller like in the first script.
    Since it runs fine.
    But when I login with the new user that it made.
    Then the system Fails bigtime..

    Well thanks anywho. But I think this is really my problem that I cant post on the forums for an answer. Since well I cant ask you to read an entire script and execute it on your system. Since you'll just add a never used user on ur system.

    Thanks, anywho
    New Users, please read this..
    Google first, then ask..

  8. #8
    Linux Enthusiast likwid's Avatar
    Join Date
    Dec 2006
    Location
    MA
    Posts
    649
    Robin: A little off-topic pointer here: a lot of that code in the snippet I see can be removed by using useradd more efficiently. For example, the -m switch for useradd creates a home directory. In conjunction with -k, you can automatically copy files under say /etc/chroot_skel. adduser is only included on some systems, usually as a frontend to useradd.

  9. #9
    Linux Engineer RobinVossen's Avatar
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    1,422
    Oh, well I didnt know about -k.
    but then still.
    Most of the files have to be changed for the user it self.

    Thanks for the Advice though
    New Users, please read this..
    Google first, then ask..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...