Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
A=/etc/squid/squid.conf
echo "Enter the path to the squid.conf file:"
printf "default path is = $A: "
read A
if [ "$A" = "" ]; then
A=/etc/squid/squid.conf
fi
echo ""
B=/usr/lib/squid/pam_auth
echo "Enter the path to the squid.conf file:"
printf "default path is = $B: "
read B
if [ "$B" = "" ]; then
B=/usr/lib/squid/pam_auth
fi
echo ""
a=$(grep -m1 -n "#Recommended minimum configuration:" < $A | cut -d: -f1)
sed -i ''$a's/#Recommended minimum configuration:/\
#Recommended minimum configuration:\
#Added by Server Setup Script\
auth_param basic program\
$B\
acl pam proxy_auth REQUIRED\
http_access allow pam\
#Added by Server Setup Script/' $A
and the problem now is in my /etc/squid/squid.conf file this comes out
#Added by Server Setup Script
auth_param basic program
$B
acl pam proxy_auth REQUIRED
http_access allow pam
#Added by Server Setup Script
it doesn't seam to output the variable, can you tell me how to do that?
echo "Enter the path to the squid.conf file:"
read -p "default path is /etc/squid/squid.conf : " info
if [ "$info" = "" ]; then
A=/etc/squid/squid.conf
#echo A=$A
else
A=$info
#echo A=$A
fi
um, maybe i miss said what i was wanting ... the $A variable is fine, it's the $B variable that ends up in the squid.conf as '$B' instead of '/usr/lib/squid/pam_auth'
echo "Enter the path to the pam_auth file:"
read -p "default path is /usr/lib/squid/pam_auth : " pam_info
if [ "$pam_info" = "" ]; then
B=/usr/lib/squid/pam_auth
#echo B=$B
else
B=$pam_info
#echo B=$B
fi
Use $B which will be the default /usr/lib/squid/pam_auth if the user presses enter at the prompt....
echo "Enter the path to the pam_auth file:"
read -p "default path is /usr/lib/squid/pam_auth : " pam_info
If the user types in another path then, $B will have that value.
A=/etc/squid/squid.conf
echo "Enter the path to the squid.conf file:"
printf "default path is = $A: "
read A
if [ "$A" = "" ]; then
A=/etc/squid/squid.conf
fi
echo ""
echo "Enter the path to the pam_auth file:"
read -p "default path is /usr/lib/squid/pam_auth : " pam_info
if [ "$pam_info" = "" ]; then
B=/usr/lib/squid/pam_auth
#echo B=$B
else
B=$pam_info
#echo B=$B
fi
a=$(grep -m1 -n "#Recommended minimum configuration:" < $A | cut -d: -f1)
sed -i ''$a's/#Recommended minimum configuration:/\
#Recommended minimum configuration:\
#Added by Server Setup Script\
auth_param basic program\
$B\
acl pam proxy_auth REQUIRED\
http_access allow pam\
#Added by Server Setup Script/' $A
and the /etc/squid/squid.conf file still looks like this ...
#Added by Server Setup Script
auth_param basic program
$B
acl pam proxy_auth REQUIRED
http_access allow pam
#Added by Server Setup Script
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.