Programming :: Dereferencing Exported Variable?
Jul 6, 2010This is probably a very easy thing to do, but I don't know how: I'd like to export an env't variable, and then use its reference in a Bash script
Code:
This is probably a very easy thing to do, but I don't know how: I'd like to export an env't variable, and then use its reference in a Bash script
Code:
I'm using a simple Bash script to export an environment variable, eg.
Code:
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/my/own/dir
[code]....
I have got following code from a book:
Code:
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h>
#include <stdlib.h>
#define PORTNUMBER 12345
[Code]...
When i ssh to server using -X, i always confuse about which display number i should export. It seems to me sometimes the display number has been used by something, so what i can do is only
export DISPLAY=localhost:0 && xclock
export DISPLAY=localhost:1 && xclock
export DISPLAY=localhost:2 && xclock
[code]....
I have what should be a relatively simple program (fadec.c) that maps a struct from an included header file (fadec.h) to a shared memory region, but Im struggling accessing members in the struct from the pointer returned by shmat. Ultimately, I want to access members in the shared memory structure with a globally declared version of the struct, shm__. Not only do I not know how to accomplish that, but I cant even seem to access members of the shared struct directly from the pointer itself (compiler complains about dereferencing pointer to incomplete type). Im at a loss and could use another set of eyes if you guys dont mind taking a gander:
Compile Errors:
tony-pc:/cygdrive/p/test> cc -o fadec fadec.c
fadec.c: In function 'main':
fadec.c:30: error: dereferencing pointer to incomplete type
fadec.c:31: error: dereferencing pointer to incomplete type
[Code]...
I am playing around with a new chat program and I have errors that I can not figure out. Here is what I am getting.
parse.c:1638: error: dereferencing pointer to incomplete type
parse.c:1638: error: dereferencing pointer to incomplete type
parse.c:1638: error: dereferencing pointer to incomplete type
here is the code:
if (scan->jail_timeout == 0 && scan->location == prison)
{
command_type |= HIGHLIGHT;
tell_player(scan, " After serving your sentence you are flung out"
[code]....
I'm trying to read content of file to variable and use this variable in for loop. The problem is, when I have c++ comment style in file - /*. Spaces in line are also interpreted as separated lines.
For example:
Code:
Changing $files to "$files" eliminate these problems but causes that whole content of variable is treated as one string (one execution of loop).
my script has a variable which comes in the form +00.00 +0.00 -00.00 or -0.00 (the numbers can be any in that form) for any that have a + symbol I need to remove the +, but if it has a - symbol it needs to stay.
i need to make a new variable with the string from the old variable btut without any plus sign. I have tried a lot of different ways with no success, each thing I tried either left the + or removed the entire string. I think this should work but doesn't
foo=+12.40
bar=${foo#+}
how I can search within a variable and assign the results to a new variable. I'll use the following as an example -
cars="Audi BMW Cadillac Chevy Dodge Ferrari Ford Mercedes"
list=`echo ${cars} | egrep -o '<A?+|<C+'`
with the echo command I get the following output assigned to list -
A
C
C
What I'd like to get for output is -
Audi
Cadillac
Chevy
how I could do this regardless of upper/lower case letters?
included shell script inside c program, and i wanted to assign the value of c variable to shell variable..Can any one please suggest me how to do it?
View 8 Replies View RelatedThis loop is part of a bash script which takes multiple arguments.
Code:
for ((i=1;i<=$number;++i)) ; do
offset=$(($i+5))
[code]...
i want to pass variable in mysql qyery in c programming
View 1 Replies View RelatedI have a filesystem mount at /A. I can export that filesystem via nfs with no issues.
I then mount an ISO image in a folder under /A: mount -o loop fname.ISO /A/isomnt. The original mount /A had the nohide option.
The files in the ISO image are available on the local machine, but the submount doesn't get exported by nfs to any other systems (FWIW: it does show up via samba). I have even run exportfs -a after the ISO mount, but that did nothing.
I have several ISO files that I would like to make available this way, without having to make several nfs exports for all of these, and then make mount commands on all of the remote systems.
Is this possible? If so, what do I need to do to make this work?
I have a machine which had a hardware fault and I want to read the disks by plugging them into a SATA-USB docking station in another machineWhen I do thisI can see the partitions on the old disk, but cannot read the LVM volumes on one of these physical partitions.Commands like pvscan do not find anything on this disk. Apparently you are supposed to export the volumes before trying to read them on a new system, but this was not performed. Does anyone know how to access the data on this disk? Surely it is possible.
View 1 Replies View RelatedI have an exported (via NFS) file system that contains other sub-mounted file systems (eg, DVD drives, ISO files, etc). While the sub-mounts show up locally, they aren't visible when the parent mount is exported.
In /etc/exportfs, the nohide option is specified for that export.
What else do I need to do?
So after much intense reading of linux documentation and posts I can't find an answer to my question. Maybe someone can help.I am trying to access a kernel symbol that isn't exported (the symbol exists in /proc/kallsyms but not in Modules.symvers). Is there a non intrusive way (by avoiding compiling the kernel with CONFIG_KALLSYMS and parsing /proc/kallsyms in my LKM) to reference kernel symbols that are in /proc/kallsyms and not in Modules.symvers i.e. not exported symbols.
View 1 Replies View RelatedI am using OpenSuSE 11.3 (64 bit) and am trying to force my new server use NFSv4. Later, GSSAPI, sould be added, but for beginning, I want to configure without it for now. If I try using NFSv3, this works good, but I need NFSv4. I have exported my directory:
Code:
omega:/ # cat /etc/exports
/distrib *(ro,no_root_squash,sync,no_subtree_check)
After mount attempt I have a error:
Code:
omega:/ # exportfs -var
[Code]...
firstly it took a very long time to display the browser.After the browser was working on my localmachine it took really long time to show the response.I am doing all this on internet and the server has bandwidth as 6Mbps and my internet connection has a speed 1Mbps what could be the reason for such a slow response.The same exists in case of Chromium is there a way to make it fast.Ubuntu 10.04 server edition and ssh2.
View 2 Replies View RelatedI have beat this enough and don't get what should have been a very simple thing to do. I build a variable;
Code:
CLIST=java,lua,python,php,perl,ruby,tcl
CLIST will be used by another bash script but I need to replace the commas with a space. I
[code]...
How would I go about defining a variable from a document name. Example:document01.doc I want to take the 01 and set X to equal integer 1.
View 1 Replies View RelatedI need to replace JAVA_OPTS= with JAVA_OPTS=<some_value>.I need to give "" value at the end of the replacement. I have tried with the following but it is not working: sed -e "s|JAVA_OPTS= |JAVA_OPTS=<some_value>"
View 2 Replies View RelatedI have been searching most of today and am stuck on getting a variable into an awk portion of my bash script. I have this working:
Code:
#!/bin/sh
SRC=/var/log/mail.log
DEST=/var/www/output/myFile.txt
VAR=userName@myDomain.tld
[code]....
Can awk take a shell variable? Or do I have to do something completely different?
In C++ what does the suffix, "*" mean appended to a variable type, e.g., "char* variable1;"?
View 3 Replies View RelatedFollowing is the way I saw a variable initialized in C
Code:
static const unsigned int rtl8139_rx_config =
RxCfgRcv64K |
(RX_FIFO_THRESH << RxCfgFIFOShift) |
(RX_DMA_BURST << RxCfgDMAShift);
on following link
[URL]
I have initialized variables in past but above initialization I could not understand what is it?
problem statement:
pattern_search="Exam Name"
sed -n "/$pattern_search/,/hello/"p tmp5 | awk '{if ( $4 != 0 && $4 ~ /[0-9]+.*[0-9]*/ ) print "$pattern_search" " " $0 }'
"tmp5" is a file. this is printing output as
$pattern_search value1
i.e value of $pattern_search is not getting substituted. i am expecting output as
Exam Name value1
how shall I print each variable separately using a generalized form. I tried writing the following within a for loop...Code:echo $(echo a$(echo $i)$(echo $j))which did yield no result. So what shall I write??
View 3 Replies View RelatedI have the following input:
Code:
Event 1............................................................
full_name: JENNY_JENNINGS genre: f
age: 32
[code]....
But as you can see in the input, in the 2nd "Event", the line containing "age" is not present, but in the output my code is printing the 1rst age value twice. The correct output should be blank in the age field for 2nd line in the output like this:
Code:
full_name|genre|age|code
JENNY_JENNINGS|f|32|15a
JOHN_JOHNSON|m||23c
MARY_JEAN|f|25|11d
What is wrong in my code? how can I fix it? * I�m using ubuntu 10.10
How are environment variable set in tcl? I tried "set $env(MYVAR) xxxx" but it didn't work.
View 1 Replies View Relatedi'm trying to execute a shell script, i'm trying to use the values in an array for use in a sed command:
sed -n '/Sales ID: ${array[$i]}/,/Totals:/p'
that command creates empty files. so my guess is that its not recognizing the array as an array but as text?
how would i be able to utilize the array in the command? i got it, didnt think that if i doubled up the single quotes that it would work, but this worked:
sed -n '/Sales ID: '${array[$i]'}/,/Totals:/p'
I have a directory file capturing script, the variable is fine with in the loop but gone after the loop is done:
Code:
DIR="/usb/sdb1/media/music/"
i=1
[code]...