SimpleSi Posted February 29, 2008 Posted February 29, 2008 Sometimes I get really frustrated when the diffs between Linux and MS catch me out I'm trying to automate my eeePC deployment by creating a superscript to run all the things I've put on the wiki Auto Connect but I'm bombing out straight away. Should this script work #!/bin/bash sudo mkdir /mnt/sharename sudo chmod 777 /mnt/sharename sudo cp ./etc/network/if-up.d/nynetstart /etc/network/if-up.d/mynetstart sudo chmod 777 /etc/network/if-up.d/mynetstart sudo cp ./home/user/.network-autostart /home/user/.network-autostart sudo chmod 777 /home/user/.network-autostart sudo ln -s /mnt/sharename sharename I try running it using sh ./installnet.sh (which is what is called) (its in /home/user) I'm just getting garbage error msgs saying things like ":command not foundne 2:" and then finding there is a folder called sharename? being created in /mnt I know I'm missing something fundemental but I can't work out what help regards Simon
Geoff Posted February 29, 2008 Posted February 29, 2008 add this as the second line of your script: set -x Read through the output carefully. More info on the 'set' command can be found by typing 'help set' at your nearest console window.
Gerry Posted February 29, 2008 Posted February 29, 2008 sudo cp ./etc/network/if-up.d/nynetstart /etc/network/if-up.d/mynetstart Simon Possibly a slight typo in the above line?
SimpleSi Posted February 29, 2008 Author Posted February 29, 2008 @geoff As usual - your comments are of no practical use but I'm sure with another 4 hours of work I could get there (I just get :invalid option line 2: set: - Could you not just say in english what I need to do? @Gerry - ta for info - it'll come in handy when I get the 1st line working regards Simon
Gerry Posted February 29, 2008 Posted February 29, 2008 Try running the script like this: sudo ./installnet.sh I typed in "help sh" and got shift: shift [n] The positional parameters from $N+1 ... are renamed to $1 ... If N is not given, it is assumed to be 1. shopt: shopt [-pqsu] [-o long-option] optname [optname...] Toggle the values of variables controlling optional behavior. The -s flag means to enable (set) each OPTNAME; the -u flag unsets each OPTNAME. The -q flag suppresses output; the exit status indicates whether each OPTNAME is set or unset. The -o option restricts the OPTNAMEs to those defined for use with `set -o'. With no options, or with the -p option, a list of all settable options is displayed, with an indication of whether or not each is set.
SimpleSi Posted February 29, 2008 Author Posted February 29, 2008 @gerry Haven't got access to a machine until tonight but I'm sure I tried sudo ing and got a different error msg but I'll try again ) I typed in "help sh" and got :confused: Don't know what you are trying to tell me! regards Simon
Gerry Posted February 29, 2008 Posted February 29, 2008 Ooops! Quite right, doesn't make much sense out-of-context! And it's actually wrong - my initial thought after running "help sh" in a terminal was that it was not Bash but something else. I should have used "man sh" - more descriptive. I'm not a Linux guru, but I have been using Ubuntu now for a few months. You don't need to use "sh ./installnet.sh" if you make the script executable. In a terminal type: sudo chmod +x installnet.sh then you can remove the "sh". If your script still won't work, paste the full output from the terminal here for us to examine.
SimpleSi Posted March 7, 2008 Author Posted March 7, 2008 @geoff - I'm very very sorry I just thought that it would be something simple that someone could easily point out (like need to run as root or something like that ) And I was tearing my hair out cause I knew it was something simple It was. I'll make a new post so other pretend @nix geeks son't get caught out like me Sorry again regards Simon
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now