I am new to shell (i.e. linux bash) programming and have the following question:
When using this wget command I can download a certain website that needs login information by passing a previously acquired cookie:
As cookies sometimes get very long, I want to shorten the command by storing the cookie in a variable and passing the value of that variable as an option to wget like this:
But this doesn't seem to work at all. The cookie is not being passed to the website as in the first case. Who knows what I am doing wrong?
Folks,
I've been trying to use the ENV variable with slashes(/) in its value inside the sed substitution..
Sed 's/myval/'$MYVAL'/' file1 >> file.tmp
If MYVAL=<sometext>, it works.
if MYVAL=/home/venkat, it doesnt.
***************************
bash-2.05$ export VAL=/home/venkat... (5 Replies)
I would like to know how to pass a variable inside a variable to a function.
sample code below
--------------
for x in 1 9
do
check_null $C$x ##call function to check if the value is null
if
then
echo "line number:$var_cnt,... (2 Replies)
Any help would be great. I know this is a dumb way of doing this, but I would like to know if there is a solution doing it this way. I'm very new at this and I'd like to learn more. Thanks! :D:D
count=0
while ; do
echo "enter your name"
read name_$count
let count=count+1
done
... (2 Replies)
I'm creating a junk script which utilizes either -l or -p to list files or remove files, respectively, in the junk directory. When I run this code, inputting '-p' is unrecognized through the whole if/else block and falls to the last else (echo do nothing). In addition, I switched tests and tested... (2 Replies)
I am just learning shell scripting and already I found out I have the bad habit of thinking that it is similar to php or c.
I learned some basics and now encountered this problem:
On shell it is possible to type:
$ date --date="2009-10-10 09:08:34"
Sat Oct 10 09:08:34 CEST 2009
... (2 Replies)
Hi Folks
I have got to the point where I can specify the arguments but how to pass an option is still mystery to me. Example:
temp.csh a b c d
set temp1 = $argv
set temp2 = $argv
set temp3 = $argv
echo $temp1
a
echo $temp2
b
echo $temp3
c d
I WANT:
temp.csh a b c d -S 1
set temp1... (2 Replies)
Hi ,
How can I pass option and parameter together?
I want like
script.sh par1 par2 -s option1
And when I am doing
echo $1
echo $2
#opt is the variable where we are storing the option value through getops
echo $opt
output should be (4 Replies)
I have a small program which needs to pass variable dynamically to form the name of a second variable whose value wil be passed on to a third variable.
***************** Program Start ******************
LOC1=/loc1
PAT1IN=/loc2
PAT2IN=/loc3
if ; then
for fpattern in `cat... (5 Replies)
I have a below syntax its working fine...
var12=$(ps -ef | grep apache | awk '{print $2,$4}')
Im getting expected output as below:
printf "%b\n" "${VAR12}"
dell 123
dell 456
dell 457
Now I wrote a while loop.. the output of VAR12 should be passed as input parameters to while loop and results... (5 Replies)
I may have asked this before, so forgive OF.
Problem:
I can pass positioning array as -- menu option to whiptail, but it does not show in the whiptail form as an array - only single (first member "lsusb" ) entry / line shows up.
Code:
DynamicEntry=$(whiptail \
--title "DEBUG... (1 Reply)
Discussion started by: annacreek
1 Replies
LEARN ABOUT CENTOS
xfreeeventdata
XGetEventData(3) XLIB FUNCTIONS XGetEventData(3)NAME
XGetEventData, XFreeEventData, XGenericEventCookie - retrieve and free additional event data through cookies.
SYNTAX
Bool XGetEventData(Display *display, XGenericEventCookie *cookie);
void XFreeEventData(Display *display, XGenericEventCookie *cookie);
ARGUMENTS
display Specifies the connection to the X server.
cookie Specifies the cookie to free or retrieve the data for.
STRUCTURES
typedef struct {
int type;
unsigned long serial;
Bool send_event;
Display *display;
int extension;
int evtype;
unsigned int cookie;
void *data;
} XGenericEventCookie;
DESCRIPTION
Some extension XGenericEvents require additional memory to store information. For these events, the library returns a XGenericEventCookie
with a token ('cookie') unique to this event. The XGenericEventCookie's data pointer is undefined until XGetEventData is called.
The XGetEventData function retrieves this extra data for the given cookie. No round-trip to the server is required. If the cookie is
invalid or the event is not an event handled by cookie handlers, False is returned. If XGetEventData returns True, the cookie's data
pointer points to the memory containing the event information. A client must call XFreeEventData to free this memory. XGetEventData
returns False for multiple calls for the same event cookie.
The XFreeEventData function frees the data associated with a cookie. A client must call XFreeEventData for each cookie claimed with
XGetEventData.
EXAMPLE CODE
XEvent event;
XGenericEventCookie *cookie = &ev;
XNextEvent(display, &event);
if (XGetEventData(display, cookie)) {
handle_cookie_event(cookie->data);
} else
handle_event(&event);
}
XFreeEventData(display, cookie);
NOTES
A cookie is defined as unclaimed if it has been returned to the client through XNextEvent but its data has not been retrieved via
XGetEventData. Subsequent calls to XNextEvent may free memory associated with unclaimed cookies. Multi-threaded X clients must ensure
that XGetEventData is called before the next call to XNextEvent.
SEE ALSO XNextEvent(3),
Xlib - C Language X Interface
X Version 11 libX11 1.6.0 XGetEventData(3)