Programming :: Embed Variable Definitions Within Constants So They Can Be Interpreted?

Jun 30, 2011

Say I have arrays of constants code...

Is it possible to induce bash to interpret the ${tbl[1]} part to its actual value (1-6) when I reference those particular entries in the arrays?
Using this instruction to do so code...

View 9 Replies


ADVERTISEMENT

Programming :: Way To Use Constants In C?

Oct 29, 2010

What is the best way to use constants in C? I have heard that constants can save ram but my question is do you use it on immediate values, variables that don't change, or codes that repeat them selves a lot

View 6 Replies View Related

Programming :: An Assembler Directive To Interpret All Constants In Hexa?

Jul 9, 2011

GNU assembler 2.17 And without having to prefix them. I'm skimming through as info page and can't find any pseudo operator or assembler directive of this type. E.g. 74 would be a decimal number. But I want it to be hexa 74 without the need to write 0x74.

NOTE: as is the GNU assembler.

EDIT: Google led me to discover this:

Quote:

If you write numbers without an explicit indication of the base, the most recent `.RADIX S' command determines how they are interpreted. However, on the one hand, it says the most recent and, on the other one, it applies to GASP, the GNU assembler preprocessor. IDK if it is the same as as (the GNU assembler).

View 2 Replies View Related

Programming :: Definitions For C Library Functions ?

Apr 24, 2010

Where are the definitions for C library functions located? It was just recently that I realized that header files don't actually define any functions, they merely include their prototypes.

For instance, stdio.h includes the following line:

Code:

This just means that the definition of printf() is located in another file. What file? Is there some kind of default shared object file that is automatically included during compilation?

View 2 Replies View Related

General :: Embed "DISPLAY" Variable In "su" Command?

Sep 8, 2010

I'm trying to create mozilla profile for another user from command line using su. When I'm trying from X, this will work. su myuser -c 'mozilla -CreateProfile newprofile' But my goal is to embed this to a script and it will execute only in command line mode. If I try this, from a command line, It also works: ISPLAY=1.0 mozilla -CreateProfile newprofile how to embed "DISPLAY" variable in "su" command, cause this fails: su myuser -c 'DISPLAY=1.0 mozilla -CreateProfile newprofile'

View 5 Replies View Related

Programming :: Bash - Read Content Of File To Variable And Use This Variable In For Loop ?

Aug 21, 2009

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).

View 6 Replies View Related

Programming :: Make A New Variable With The String From The Old Variable Btut Without Any Plus Sign?

Apr 7, 2010

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#+}

View 4 Replies View Related

Programming :: Search Within A Variable And Assign The Results To A New Variable?

Apr 25, 2011

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?

View 5 Replies View Related

Programming :: Assign Value Of C Variable To Shell Variable?

Apr 28, 2010

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 Related

Programming :: Assignment To A Variable Variable?

Mar 17, 2011

This loop is part of a bash script which takes multiple arguments.

Code:
for ((i=1;i<=$number;++i)) ; do
offset=$(($i+5))

[code]...

View 3 Replies View Related

Ubuntu Servers :: PHP Pages Downloaded Instead Of Interpreted

May 1, 2011

I'm trying to configure Apache2 with mod_fcgid and PHP5.

I wrote the wrapper scripts according to the following how-to: [url]

However, I'm stuck with my browser trying to download the PHP pages when I go to my website.

View 9 Replies View Related

Software :: Launch Script To Be Interpreted On Screen Session?

Jan 27, 2010

I am on an xubuntu live cd setting up gentoo linux. I use screen to make sure that all my compiling and whatnot runs in the background and I won't accidently exit it. I have a script that I have written that autoruns starting my screen session, whenever I insert my thumbdrive. A seprete script should be passed along to screen telling it to chroot into my gentoo setup. However, whenever I use screen -X ./myscript.sh it says that it is an unknown command. How can I pass it along to screen?

View 1 Replies View Related

Programming :: Pass Variable In Mysql Qyery In C Programming?

Dec 4, 2010

i want to pass variable in mysql qyery in c programming

View 1 Replies View Related

Ubuntu :: Incorrect Folder Path Definitions

Feb 5, 2011

I have somehow managed to wreck the definitions /paths for my Home and Desktop. If I click on Places I now have a "Home Folder" displayed as "Open Your personal Folder", a "Desktop" displayed as "Open the contents of your Desktop in a folder" and a second "Home Folder" displays as "Open '/home/ian'"....and they all point to the same folder which is my personal user file "ian". This is kind of OK except that every file I have now gets displayed on my screen because "Desktop" has a view of these files. Is there any easy way to reset my file directory ? or do I have to backup my files and reinstall Ubuntu.

View 2 Replies View Related

Red Hat / Fedora :: How To Update Clamav Virus Definitions

Jun 14, 2009

I have installed clamav antivirus,and while scanning it shows the following warning

LibClamAV Warning: **************************************************
LibClamAV Warning: *** The virus database is older than 7 days! ***
LibClamAV Warning: *** Please update it as soon as possible. ***
LibClamAV Warning: **************************************************

And so i have tried to update the virus database as root,using this command

# freshclam
bash: freshclam: command not found

but i cant,can you pls say me how to update the virus database...

View 10 Replies View Related

Software :: Memory Usage General Definitions On Top ?

Oct 27, 2009

I was playing with top to understand ram memory usage of every thread but i am in trouble with some basic questions:

- what difference is between 'thread' and 'process'?

- what does 'virtual image size' means, and Resident size, Shared Mem size, Code size, Data+Stack size, Swapped size? I thought that the only important field is 'Memory usage', but it is represented as a percent value...

I have googled a bit, but nothing really helped me. before opening top i thought that memory is divided in several pages by every process/thread (?) and that this occupied memory would be counted as 'used memory', and nothing else.

View 8 Replies View Related

Red Hat / Fedora :: Find Signal Handlers Definitions In Kernel?

Apr 9, 2011

I am currently working on "Creation of Postmortem data logger in Linux on Intel architecture. Its nothing but core utility creation. how the signal handlers for various signals(SIGSEGV,SIGABRT,SIGFPE etc) which produce core dump upon crashing an application internally implemented in Linux kernel. I need to re-write these signal handlers with my own user specific needs and rebuild the kernel. It makes my kernel producing the core file (upon crashing an application) with user specific needs like showing registers,stackdump and backtrace etc.

View 1 Replies View Related

General :: Find The Scope / Definitions Of A Class / Methods?

Feb 13, 2010

In Windows environment when I used Borlan for C/C++ compilation, I was used to find the the scope/definitions of the methods/classes by pressing

Code:
ctrl + F1

when the cursor was hovering on that method/class. How can I find the scopes/definitions in the GNU/Linux?

Code:
//atoi.cc
#include <iostream>
main(int argc, char* argv[]) {
float var_float = atof(argv[0]);

[Code]....

View 5 Replies View Related

OpenSUSE :: Can't Seem To Find In Repositories Is Software For Dictionary Definitions / Thesaurus

Feb 19, 2010

What I can't seem to find in the repositories is software for Dictionary Definitions and a Thesaurus - in another distro there is what is called "Online Dictionary" (which includes synonyms) and another distro there is what is called "WordNet";So, I would like to know the name(s) to look for in the repositories for software for a Dictionary / Thesaurus, where it is two different software packages or just one.I did see the "webpin" finds "WordNet", but installation of that fails.

View 7 Replies View Related

Programming :: Sed A Variable In Bash?

Mar 25, 2011

I 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]...

View 2 Replies View Related

Programming :: C++ Get Variable Name From Document Name?

Apr 9, 2010

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 Related

Programming :: Defining Variable With Sed?

Jun 2, 2010

I 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 Related

Programming :: Can Awk Take A Shell Variable

Jul 23, 2010

I 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?

View 11 Replies View Related

Programming :: C++ Variable Type Followed By *?

Jul 1, 2010

In C++ what does the suffix, "*" mean appended to a variable type, e.g., "char* variable1;"?

View 3 Replies View Related

Programming :: Initializing A Variable In C?

Nov 5, 2010

Following 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?

View 4 Replies View Related

Programming :: Print Variable Value In Awk?

May 16, 2011

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

View 3 Replies View Related

Programming :: Retrieving Value From Variable

Feb 5, 2010

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 Related

Programming :: Release Value Of Variable In Awk?

Mar 8, 2011

I 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

View 12 Replies View Related

Programming :: Set Environment Variable Is Tcl ?

Apr 22, 2011

How are environment variable set in tcl? I tried "set $env(MYVAR) xxxx" but it didn't work.

View 1 Replies View Related

Programming :: Using Variable In A Command?

Apr 14, 2011

i'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'

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved