Thread: Bash Scripting
hi guys, new here, trying create simple script, along lines :
#!/bin/bash
cd /home/example/;
./configure;
make;
make install;
cd /home/sabre/example2/;
./configure;
make;
make install;
kinda worked out needed ; @ end of commands (which took me ages work out) not sure when use ; , there's alot of documentation && , other things, have no idea . getting alot of error when trying this.
it helpful if use code tag surround script. right now, i'm not entirely sure question is.
semi-colon ";" needed when want put multiple commands on same line. put commands on separate lines.
however, think you're wanting use "&&", executes next command if , if prior command succeeded. (no sense running "make" if configure failed, right?)
let's tweak have above this:
there 2 major problems script.code:#!/bin/bash cd /home/example ./configure && make && make install cd /home/sabre/example2 ./configure && make && make install
- `make install` fail unless run root priviliges (e.g. sudo)
- most of errors encounter not bash errors
there minor problem script assumes directories exist , contain `configure` command.
additionally, may need pass arguments `configure`--something simple script doesn't do.
personally, think you'd better off doing these steps individually. have years of shell programming experience , script compile packages *huge* because wanted trap , handle many different errors.
hth
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [ubuntu] Bash Scripting
Ubuntu
Comments
Post a Comment