View Full Version : [ubuntu] Using Scripts.sh??
JonnySnip3r
September 19th, 2009, 02:45 AM
Hey guys i am just curious how would i go about writing a script to install something?
here is what i have, what i want to do is install VLC Media Player.
#!/bin/sh
echo “I Will now install VLC Media Player”
sudo apt-get install vlc
ok how do i make it answer "YES"? when it asks the user question? hope someone can help thanks in advance.
Partyboi2
September 19th, 2009, 03:29 AM
You can use the -y flag so
sudo apt-get install -y vlc
#!/bin/sh
echo “I Will now install VLC Media Player”
if [ "$(id -u)" != "0" ]
then
echo ""
echo "Must execute the script as root user."
exit 1
fi
apt-get install -y vlc
falconindy
September 19th, 2009, 04:33 AM
You can use the -y flag so
sudo apt-get install -y vlc
#!/bin/sh
echo “I Will now install VLC Media Player”
if [ "$(id -u)" != "0" ]
then
echo ""
echo "Must execute the script as root user."
exit 1
fi
sudo apt-get install -y vlc
Sorry to nitpick, but if you're checking that the script was executed by root, then you don't need the 'sudo' for the apt-get command.
Partyboi2
September 19th, 2009, 04:34 AM
Sorry to nitpick, but if you're checking that the script was executed by root, then you don't need the 'sudo' for the apt-get command.
Good point :P
JonnySnip3r
September 21st, 2009, 10:51 AM
Thanks dude :) very helpful :D:D:D
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.