LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 03:22 PM   #1
jv2112
Member
 
Registered: Jan 2009
Location: New England
Distribution: Arch Linux
Posts: 719

Rep: Reputation: 106Reputation: 106
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, 04:06 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

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

Original Poster
Rep: Reputation: 106Reputation: 106
Thanks

Need new glasses.....
 
  


Reply



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 02:28 AM
cron bash script troubles zzyzx Slackware 3 04-12-2005 12:27 PM
Cron script troubles Galphar Linux - Newbie 1 01-19-2005 01:32 PM
Firewall Script Troubles ASP Linux - Security 3 09-23-2003 01:16 PM
some troubles with a script Ciccio Linux - Software 3 03-22-2003 07:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:05 PM.

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
Open Source Consulting | Domain Registration