I'M trying to write a shell script using && so that each line will only execute if the preceding line executed without any problems.

How would I do that with the following cat:?

cat > /etc/nsswitch.conf << "EOF"
# Begin /etc/nsswitch.conf
passwd: files
group: files
shadow: files
hosts: files dns
networks: files
protocols: files
services: files
ethers: files
rpc: files
# End /etc/nsswitch.conf
EOF 


&


sed -i "s|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=$DL -o|" \
        scripts/test-installation.pl
unset DL

"nsswitch.conf - System Databases and Name Service Switch configuration file"
Nothing in /etc/nsswitch.conf "executes", perhaps you have another example?

The commands that this script runs are from the linux from scratch project. I just need to know how to write a script with the cat redirection, sed and unset using && to verify that each line executed correctly before continueing to the next line.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.