Skip to main content

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:
code:
#!/bin/bash    cd /home/example  ./configure && make && make install    cd /home/sabre/example2  ./configure && make && make install
there 2 major problems script.

  1. `make install` fail unless run root priviliges (e.g. sudo)
  2. 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

Popular posts from this blog

Connecting Raspberry Pi 2 to P10(1R)-V706 LED Dot Matrix - Raspberry Pi Forums

TypeError: <unknown> is not a numpy array - Raspberry Pi Forums

datso and removing imagetitle - Joomla! Forum - community, help and support