BrianUK wrote:
Code:
echo "Installing software"
apt-get -y install etc etc
echo "Software Installed"
How do I make the script wait for the above process to finish before starting the next one? I saw something about wait $! would this do it?
Why would you assume that the process in your script will return your prompt
before it is done? Like all (unix) commands, you will only get your commandprompt back after a command or process is complete. The only exception is when you specifically start a process as a background process.
BrianUK wrote:
Code:
#!/bin/bash
rm /etc/network/interfaces
touch /etc/network/interfaces
echo "Configuring Network"
echo "# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback"
> /etc/network/interfaces
echo "Network Setup Complete"
It creates the interfaces file but it's blank? probably to do with how i've done the > or using " any ideas?
Try putting the output redirection (> /etc/network/interface) on the same line where your echo command ends.
Putting it on a new line will output 'nothing' to your filename, just as you request.
BrianUK wrote:
Also i'll need to configure install various modules will I have to 'wait' after each one ie
Code:
apt-get -y install libusb-dev
wait
cpan -fi Bundle::CPAN
wait
cpan -fi ExtUtils::MakeMaker
wait
cpan -fi Inline::MakeMaker
wait
cpan -fi Device::USB
Again, why are you assuming that these commands would be run simultaniously instead of one after the other? The 'wait' command is only used to wait for processes that have specifically been started as a background process. As you have not started these as background processes, each command will only start after the previous one is finished.