LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-31-2011, 04:22 PM   #1
jv2112
Member
 
Registered: Jan 2009
Location: New England
Distribution: Arch Linux
Posts: 719

Rep: Reputation: 103Reputation: 103
Question Script Troubles


I am trying to construct a script to use with pacman so I can stream line the process for my wife who is not as command line savy. The script below does not execute the second case statement however the same line works fine in the shell which I launched the script from.

Not sure where to go :


Any ideas ?


Quote:

#! /bin/bash
2 # -- > Pacman GUI Attempt
3 priv=$(zenity --entry --text "Enter Sudo/Root Password" )
4
5 ans=$(zenity --list --text "What pacman action?" --radiolist --column "Pick" --column "Option" TRUE "Syu:Sync/Upgrade" FALSE "Syy:Force-Update" FALSE "Install/Update Package(s)") ; echo $ans
6
7
8 case "$ans" in
9 Syu:Sync/Upgrade)
10 echo $priv | notify-send "$(sudo -S pacman -Syu)" | tee >(zenity --progress --pulsate)
11 ;;
12 Syy:Force-Update)
13 echo $priv |notify-send "$(sudo -S pacman -Syy)" | tee >(zenity --progress --pulsate)
14 ;;
15 *)
16 pac=$(zenity --entry --text "What package do you want to work with ?" )
17 pac2=$(zenity --list --text "What do you want to do with $pac ?" --radiolist --column "Pick" --column "Option" TRUE "Install" FALSE "Remove" FALSE "Search")
18 ;;
19 esac
----Where the problem is -->
20 case "pac2" in
21 Install)
22 echo $priv | sudo -S pacman -S $pac
23 ;;
24
25 Remove)
26 echo $priv | sudo -S pacman -R $pac
27 ;;
28
29 Search)
30 echo $priv | sudo -S pacman -Ss $pac
31
32 ;;

33
34 esac




 
Old 07-31-2011, 05:06 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Code:
case "pac2" in
should be
Code:
case "$pac2" in
you simply missed the $ sign.
 
Old 07-31-2011, 06:16 PM   #3
jv2112
Member
 
Registered: Jan 2009
Location: New England
Distribution: Arch Linux
Posts: 719

Original Poster
Rep: Reputation: 103Reputation: 103
Thanks

Need new glasses.....
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple Script Troubles (Please help) JamesDoom Linux - Newbie 6 05-05-2009 03:28 AM
cron bash script troubles zzyzx Slackware 3 04-12-2005 01:27 PM
Cron script troubles Galphar Linux - Newbie 1 01-19-2005 02:32 PM
Firewall Script Troubles ASP Linux - Security 3 09-23-2003 02:16 PM
some troubles with a script Ciccio Linux - Software 3 03-22-2003 08:53 AM


All times are GMT -5. The time now is 10:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration