You are not logged in.

#1 2010-03-10 02:23:48

monkeyslayer56
Member
Registered: 2010-02-04
Posts: 11

[SOLVED]probably n00b bash question...

well the story is that im working on a script in a virtual machine and my nature is to write a basic script that does some of the main gaols and doesn't loop untill i get it running smoothly. and i have this script that i can copy and paste into the terminal and it works like a charm but when i run it at the same termal via ./windows7windows i get

 $ ./windows7windows
./windows7windows: line 7: /2: syntax error: operand expected (error token is "/2")
./windows7windows: line 8: /2: syntax error: operand expected (error token is "/2")
The -e option expects a list of comma separated integers: "gravity,X,Y,width,height"

the script is

#!/bin/bash
screenx=xrandr |grep current | awk '{print $8}'
screeny=xrandr |grep current | awk '{print $10}'
# screeny=768
posx=$screenx
posy=${screeny%%,}
xpos=$(($posx/2))
ypos=$(($posy/2))
# xpos=$((1024/2))
# ypos=$((768/2))
ak=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)" ) 
akib=$(echo $ak |awk '{print $5}'|sed 's/0x/0x0/g')
wmctrl -r $akib -i -e 0,0,$ypos,$xpos,$screeny # -b add,maximized_vert

also were i commented out the hard numerical values it worked great but i want it to be dynammic since this will l probbly be packed into a live DVD for some friends of mine. also if there is a better way to do some of this please tell also please note that this is going to be part of a bigger script if i ever get this problem worked  out
thanks

Last edited by monkeyslayer56 (2010-03-10 02:34:03)

Offline

#2 2010-03-10 02:27:49

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,393
Website

Re: [SOLVED]probably n00b bash question...

Lines 2 and 3 need fixed...  something like:

screenx=$(xrandr |grep current | awk '{print $8}')

Offline

#3 2010-03-10 02:33:42

monkeyslayer56
Member
Registered: 2010-02-04
Posts: 11

Re: [SOLVED]probably n00b bash question...

thanks alot that did it smile

Offline

Board footer

Powered by FluxBB