hi guys,
sick of typing sudo yum install package
so i wrote...or rather am trying to right a simple script to do this
with a simple command:
heres what i have:
#!/bin/bash
echo "Enter package name to install..."
read $P
sudo yum install $P
it doesnt seem to want to take the variable...it just runs
sudo yum install ...$p is ignored...i also tried "$p" but this
doesnt work either...what is the correct syntax to get a command to read a variable...is this possible...aaaaaaah it must be.
Hello.
How can I write an Script that enter my password for "sudo" command automatically?
for example, I want to run a command that need root permission and when I write it in a bash script, it ask me "sudo" password for user but how can I automate it?
Can it possible for other program like logging via SSH too?
Thank you.
I have the below URL
http://linoxide.com/ubuntu-how-to/awstats/
in this URL , it have the command "sudo a2enmod cgi" to check the cgi is installed or not , but when I run it , it pops "bash: a2enmod: command not found" , I tried to install it by yum install a2enmod" , but got the below message , would advise how to install it .
Code:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.uhost.hk
* epel: ftp.cuhk.edu.hk
* extras: centos.uhost.hk
* updates: centos.uhost.hk
No package a2enmod available.
Error: Nothing to do
This is my script and the syntax to run this script is give ip and next will be the file or script you want to perform on remote server
#!/bin/bash
# The private key used to identify this machine
IDENTITY_KEY=/home/adnew.pem
syntax()
{
echo "Syntax: Ec2.sh server_ip scriptFile]"
echo "For example: ./Ec2.sh server_ip scriptFile"
exit 1
}
if [ $# -ne 2 ]
then
echo not enough arguments
syntax
fi
echo "Running script $2 on $1"
ssh -ttq -i $IDENTITY_KEY ec2-user@$1 sudo -i 'bash -s' < $2
exit
exit
echo "Done"
on script file i have give for testing
touch /root/test
ls /root/test
exit
exit
it makes the file but do not show the ls output by giving error
tcgetattr: Inappropriate ioctl for device
exit
what I have to do ??
guys help me plz............
i have install conky in my kali linux by using this command.
sudo apt-get install conky
sudo apt-get install conky-all
every thing is working fine but i wanted to change my default conky script so i used these command ..
leafpad ~/.conkyrc
to open my default conky script page but it open only blank page ...where is my default conky script page i can not find it?????
how can i find my deafult conky script page........... thanks
Hi,
I installed ghostscript via yum package manager. Later I wanted a newer version of ghostscript and compiled it from source. "make install" placed the gs executable file under /usr/local/bin/gs. This works if I run the command with absolute path, but if try to run gs, the shell will output
"-bash: /usr/bin/gs: No such file or directory"
if I echo the path variable it will display
/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
If i run whereis it will give me the correct path
gs: /usr/local/bin/gs
How do I make it work so that typing "gs" will run the executable file from the /usr/local/bin/gs?
(I am using Centos 6)
Thanks.
I don't know why I want this, but is there a way the
Code:
sudo aptitude install <package>
or
Code:
sudo aptitude upgrade
command could bypass the confirmation stage? It's always occurred to me shouldn't there be some command parameter for install/upgrade that does the work?
Let me give an example. Suppose I want to install Variety, the wallpaper changing application. Now, I know that I want to install the software with all the dependencies it requires to install/run - the entire package. So, isn't it obvious that I would press Y when aptitude shows the info what it's going to download/install and asks for permission?
I can't, however, imagine scenarios when seeing that information I'd change my mind and press N to abort the install/upgrade procedure.
I would like to use yum to install package , but how do I know the package name that I should use , for example , if I want to use ldapsearch , I tried "yum install ldapsearch" , it doesn't work , how can I know what package name to install , what package includes this command - "yum install packname" ?
thanks
Hi all,
I have a script where every line needs to be prefixed with sudo.
I was advised to run it as $ sudo /path/to/file.sh
This script needs to be scheduled in crontab to run. If I run it as above, will I be prompted for a password?
Also, one of the lines in the script is;
scp -r root@rem_server:/source/dir /local/dir
Does that mean I will have to provide two passwords: one for sudo and one for root?
Thanks,
hello sir
I m new in Linux. I m trying to install ns-allinone2.33 package in Ubuntu 10.04. according to step which I follow. i have already extract ns-allinone2.33package in home folder. bt I m getting problem in installing dependencies. when i write the command "$ sudo apt-get install build-essential autoconf automake libxmu-dev gcc-4.3", i m getting the message like "unable to fetch some archive, maybe run apt-get update or try with -fix-missing?". so because of that next steps are not working. please help me out.
I need to compare a value with different fixed value. Below is the code concept I implemented in my bash script but its giving me error.
Here "a' is the nameserver value that I extract using command line from /etc/resolv.conf. I did not put command here.
#! /bin/bash
a=1.2.3.4
if [ $a == 1.2.3.4 || 5.6.7.8 || 8.9.1.4]
then
echo " You have correct ntpserver"
else
echo"wrong ntpserver"
fi
Am I comparing the value correctly or any suggestion?
Thank you