You are not logged in.

#1 2005-11-06 18:15:05

CyberTron
Member
From: Gotland ,Sweden
Registered: 2005-03-17
Posts: 645
Website

bash+variable?

Hi!

I am trying to easy some of my scripts a little, and would like to add somehting like:

pacman -U someprog.pkg.tar.gz   into a variable for easy editing...first of all: Is this possible?

I have tried something like:   program=`pacman -U someprog.pkg.tar.gz`

although, it doesn't seem to work

any ideas?


http://www.linuxportalen.com  -> Linux Help portal for Linux and ArchLinux (in swedish)

Dell Inspiron 8500
Kernel 2.6.14-archck1  (selfcompiled)
Enlightenment 17

Offline

#2 2005-11-06 18:28:06

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: bash+variable?

did you try it with "double qulotes" instead of `back tics`?

Offline

#3 2005-11-06 18:43:23

CyberTron
Member
From: Gotland ,Sweden
Registered: 2005-03-17
Posts: 645
Website

Re: bash+variable?

no didn't try that, thought it only applied to simple text/numbers   not whole programs big_smile

thanks, will try it


http://www.linuxportalen.com  -> Linux Help portal for Linux and ArchLinux (in swedish)

Dell Inspiron 8500
Kernel 2.6.14-archck1  (selfcompiled)
Enlightenment 17

Offline

#4 2005-11-06 20:03:27

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: bash+variable?

No. If you want to set a command as a variable you use the double quotes. backtics are usually used within statements or even variables but not actually setting the variable equal to it. Example with backtics and double quotes:

today="Today is `date`"
echo $today

Offline

#5 2005-11-06 20:29:09

CyberTron
Member
From: Gotland ,Sweden
Registered: 2005-03-17
Posts: 645
Website

Re: bash+variable?

ok, thanks for clearing that up...

can I set more commands into one variable:

update="for app in $list; do pacman -S $app"


http://www.linuxportalen.com  -> Linux Help portal for Linux and ArchLinux (in swedish)

Dell Inspiron 8500
Kernel 2.6.14-archck1  (selfcompiled)
Enlightenment 17

Offline

#6 2005-11-06 20:35:41

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: bash+variable?

CyberTron wrote:

ok, thanks for clearing that up...

can I set more commands into one variable:

update="for app in $list; do pacman -S $app"

should be able to as long as $list and $app are defined before $update is called on.

Offline

#7 2005-11-06 20:56:48

CyberTron
Member
From: Gotland ,Sweden
Registered: 2005-03-17
Posts: 645
Website

Re: bash+variable?

ok, thanks a lot for your help, will try it tomorrow and post back my results


http://www.linuxportalen.com  -> Linux Help portal for Linux and ArchLinux (in swedish)

Dell Inspiron 8500
Kernel 2.6.14-archck1  (selfcompiled)
Enlightenment 17

Offline

#8 2005-11-07 10:41:50

rasat
Forum Fellow
From: Finland, working in Romania
Registered: 2002-12-27
Posts: 2,293
Website

Re: bash+variable?

My thanks too. Now in ArchWD (pactk) user can run same style of command as in pacman. I always thought its for C only.

installing curvemenu package wrote:

pactk -ip curvemenu

case $1 in
 -ip)
pkgName="$2"
InstallPkg ;;
esac

Markku

Offline

Board footer

Powered by FluxBB