Programming :: Setting Variables In C-shell?

Jul 12, 2010

I'm running into a problem when I try to set a variable to an awk output in c-shell. Right now my command is Code: set STR_MSG_TYPE = `awk -F{ '/msg_type/ {print $2}' <filename> | tr -d }'/''*' ` I then run echo to see what the output is and it returns blank, however, when I run the same awk command from the command line, I get an actual output of "MT-715". Am I setting my variable incorrectly? I do something similar using the date command to set a STR_DATE variable earlier in the code and it works fine and I use the same syntax.

View 1 Replies


ADVERTISEMENT

Red Hat :: Setting System Wide Shell Variables In RHEL5?

May 10, 2010

I have an RHEL 5 server joined to a windows domain. However I wanted to add variable lines to be executed each time a user logs in. However I succeeded to put them in /etc/bashrc file and it worked like a charm.
But its annoying that everytime the user logs in to the shell remotely it displays the whole variables that were declared. Is there a way how to add them once and not to display the output each time the user logs in?

View 10 Replies View Related

Programming :: Shell - Substition Of Variables?

Mar 22, 2011

i have following code :

Code:
TMPDIR=`mktemp -d`
mkdir $TMPDIR/old/

[code]...

View 3 Replies View Related

Programming :: Advanced Uses Of Variables In Korn Shell?

Jul 28, 2011

Somehow I'm not really managing this thing, which would d be a nice way to useariables.What I am doing is setting up compound variable in ksh. What I have is a "config" file, which has fields delimited by a semicolon

Code:
cat ${CONFIGFILE} | grep -v "^#" | grep -v "^$" | while read line
do

[code]...

View 14 Replies View Related

Programming :: Exporting Makefile Variables To $(shell) Environment?

May 12, 2010

I'm aware that one can export make variables to other makefiles; however, how does one export them to the environment of $(shell)? Take the example below:

Code:
export TEST
VARIABLE=$(shell echo $$TEST)
.PHONY: all
all:
#$(VARIABLE)

In this example, I might call make TEST=test. The goal is for $TEST to be available to the environment of the shell escape. This is because I need its value in a script which is called. For example:

Code:
VARIABLE=$(shell i-need-TEST.sh)My current solution is the following:VARIABLE=$(shell export TEST="$(TEST)"; i-need-TEST.sh) but this only works if I know all if the variables needed at that point (as opposed to being able to export variables in included makefiles.) Is there an easy solution?

View 4 Replies View Related

Programming :: Indexing Variables In Lists Using Shell Scripts?

May 27, 2010

I have a question concerning indexing over lists with unix shell scripts. I have very large text files (up to 20 Gb) with the data shown below:

80011412865610
43000216943210
4710510513101

[code]...

View 14 Replies View Related

Programming :: C-shell Scripting Syntax Error When Defining Two Variables A1 And A2

Apr 5, 2011

I am trying to modify a script for research purposes and am having difficulty here as I have little prior experience with C-shell scripting.

The script looks as follows (it includes tcl commands like runFEP that you can ignore)

#!/bin/bash

for ((old=1, new=2; old<=4; old++,new++))
a1=${old}%50
a2=${new}%50
do
cat > input${new}.conf <<EOF
${a1}
code....

My question: I keep getting a syntax error when defining my two variables a1 and a2. I essentially need these variables to be
a1 = value of variable old divided by 50
a2 = value of variable new divided by 50

View 1 Replies View Related

General :: Gnuplot Variables Into Shell?

Feb 17, 2010

in gnuplot it's possible to set the value of a variable via linux shell command.or instance we can do

Code:
a="`echo 1`"
b="`echo 2`"

[code]...

View 3 Replies View Related

General :: Experimenting With Shell Variables?

Oct 12, 2010

Explain the following unexpected results

$ whereis date
date: /bin/date ?
$ echo $ PATH

[code]...

View 5 Replies View Related

General :: Variables Between Shell Scripts?

May 20, 2010

Ive created some custom shell scripts to run during the kernels boot process (they are called from the init script).I was wondering if there's any way to assign a variable that can be accessed between different scripts.For example my first script checks which type of pc i am installing on and assigns the hard drive location to a variable.HARDDRIVE = "/dev/sda1"at the end of the script it calls another script. In this script I cant reference HARDDRIVE as it is blank, to get around this I need to repeat the same code for assigning it.Its more of a space/aesthetics issue but I figured someone might know the solution off the top of their head

View 1 Replies View Related

Red Hat :: Call CGI W/POST Variables From Shell?

Jun 16, 2009

I've got a CGI that I'm trying to debug. Apache gives me an ambiguous 500 error; it would be nice to see the raw output via the shell. I've got the POST request w/headers as follows. What's the best way to troubleshoot this?

POST /cgi/packBoxes.cgi HTTP/1.1
Host: 70.87.60.214
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

[code].....

View 1 Replies View Related

General :: Setting Up Variables (in RDGEN)

Jan 17, 2010

I have installed RDGEN which comes with VPFIT package. When I run the program it says:
"Failed to find help file"
But I ran the program from its main directory where all the files including help files exist. I think maybe the problem is because of this that THEY say:
"Some environment variables should be set before starting RDGEN".
But I do not know what does this mean and how to do that.

These are the variables:
-ATOMDIR
-RD PRSETUP
-RD PRSETUP
-RDSTART
-VPFSETUP
-VPFPLOTS
Would it be possible for you to tell me what does Setting Variable means in this case?

View 2 Replies View Related

General :: Setting Variables From A Template?

Aug 23, 2010

Is there a way I can write a file that contains the text which assigns variables, e.g. string="hello world" in a file say, variables.txt and have a shell script assign those variables locally e.g.

#!bin/bash
command_that_saves_variables_locally variables.txt
echo $string
and when I run the script I would get an output of
"hello world"

View 2 Replies View Related

General :: Shell Scripts Variables Test?

Aug 5, 2010

What will be the output of the following Shell Script?

Code:
a="1245"
[-n $a]

[code]...

View 5 Replies View Related

General :: Setting (permenant) Environment Variables In 10.0.4

Sep 4, 2010

I am running an application which requires setting environment variables to be set.At the moment, the way I am achieving this is by exporting the EV at the command line, and then running the app from the command line.I want to be able to run the app from my menu (it is already a menu item after I installed it).How may I set the env var so that it is always available, so I can just run the app from the menu instead of from the CLI?

View 1 Replies View Related

Ubuntu :: Setting Environment Variables In Server 10.04

Jul 4, 2011

I always have to google about setting environment path variables when I install new software. My basic problem is that I dont know whether these variables need to be set globally or not. I have read a number of mails/tutorials which say that Environment variables should be set by simply doing an export ..eg EDITOR=nano export EDITOR

additionally I have read that it should be written into /etc/bash.bashrc

But are these really global variables or local? I want the variables to be set
even after I have logged out.

so I could also write the variable here...

/etc/environment

or here

/etc/profile

View 1 Replies View Related

Red Hat / Fedora :: Permanently Setting Environmental Variables?

Aug 6, 2010

I installed Java on a server and anytime I have to start or stop a service that requires the $JAVA_HOME variable I have to manually set it with the export command such as: Code: export JAVA_HOME=/usr/java-jdk1.6.0_21 How can I permanently set this variable?

View 3 Replies View Related

General :: Set Environment Variables For A Particular User On C Shell Configurations?

Jun 2, 2011

I have been give a task of replicating one of our production systems to create a test system. I have been restricted to use c shell to set up its environment variables. I am new to this my questions is how do i set environment variables for a particular user on c shell e.g ORACLE_HOME and ORACLE_SID permanently for a particualar user i know in bash you edit the .bash_profile file. What do i do for c shell?

View 2 Replies View Related

General :: Changing Shell From C To Bash - Apps Or Variables?

Jun 21, 2010

I have a user that has been used for long time now that runs o C Shell... now there is a need to change it to Bash Shell? Can I cause a problem changing his shell from C to bash? I mean apps or variables?

View 2 Replies View Related

General :: Formatting - Shell Script That Outputs Few Variables

Jun 6, 2011

I hav a shell script that outputs few variables. i want to output them in a table format. any unix commands?

The output i need is:

View 4 Replies View Related

Ubuntu :: Write A Simple Shell Script And Environment Variables?

Feb 8, 2010

I'm trying to write a simple shell script, its purpose is not important. The script needs to make use of the system $HOSTNAME environment variable. I had a look at this page which provides the following example.

Code:
#!/bin/sh
echo "You are user $UID on $HOSTNAME"
echo "Your home directory is: $HOME"
echo "$HOSTNAME is running $OSTYPE"

[Code]...

View 6 Replies View Related

General :: Ubuntu - Setting Environment Variables Permanently Under GNU Systems

Aug 25, 2011

I was using the command export, but it looks that after some time the set variables disappears. What is the easiest way of setting an environment variable forever?

View 2 Replies View Related

Programming :: Define All Variables In Tcl Programming In A File For Instance Var.cfg?

Apr 27, 2010

I can define all variables in tcl programming in a file for instance var.cfgand source the same file in my tcl script such assource var.cfgIs this possible in perl too?

View 3 Replies View Related

Programming :: Shell Scripting / Create A Shell Script Similar To Ls?

Jun 5, 2011

I am trying to create a shell script similar to ls, but which only lists directories. I have the first half working (no argument version), but trying to make it accept an argument, I am failing. My logic is sound I think, but I'm missing something on the syntax.

Code:
if [ $# -eq 0 ] ; then
d=`pwd`
for i in * ; do
if test -d $d/$i ; then
echo "$i:"
code....

View 10 Replies View Related

Programming :: Bash-shell-like Less Functionality In The Python Shell?

Jun 25, 2010

Is there some type of functional way to read things in the Python shell interpreter similar to less or more in the bash (and other) command line shells?

Example:

Code:

>>> import subprocess
>>> help(subprocess)
...
[pages of stuff to read]
...

I'm hoping so as I hate scrolling and love how less works with simple keystrokes for page-up/page-down/searching etc.

View 4 Replies View Related

Programming :: C With Gcc: Are All Variables Defined Like Pointers

Sep 13, 2010

i'm practicing in very basic c programs using the gcc compiler.I found that when i create two variables let's say

Code:

int a,b and Code: a=15;
b=3;
a=b;
b--;

then a equals 2.I thought that this isn't normal in C isn't it?I haven't had the time to read the gcc documentation yet...so i think it has something to do with my compiler's default settings.I use the

Code: gcc filename.c -o filename command to compile

Are all variables defined like pointers?

View 5 Replies View Related

Programming :: How To Check For Empty Variables In PHP

Apr 26, 2010

I want to check if a MySQL db query will return an empty result - I first do this:

$query="SELECT * from <whatever" ;
$result=mysql_query($query) ;
$row=mysql_fetch_row($result) ;

Now how do I check if $row is empty or not? Will $row="" do the trick?

View 2 Replies View Related

Programming :: Get List Of Variables Of Particular Type ?

Jun 13, 2011

I have a C header file which have arrays of predefined(known) structure type. But i dont have names of arrays and their size. when i include that file and compile my application, i want to know the names and sizesof those arrays.

purpose of application is to get the content of those arrays and to explain it in descriptive words instead of hex numbers.ofcourse this can be done by file pointers and reading also with out header file inclusion, but as i am working in C, once compiled, those variables are in my address space in i include header file.

View 5 Replies View Related

Programming :: Passing Variables By Reference?

Mar 19, 2010

I was trying to make a code for passing variables by reference..here's the code:

#include<iostream>
using namespace std;
void fun(int& ,int& );
int main(){

[Code].....

invalid initialization of non-const reference of type 'int&' from a temporary of type 'int*'

View 9 Replies View Related

Programming :: PHP Accessing Variables Within Array

Mar 30, 2011

I am pretty new to PHP so excuse my dumbness. I've searched this up in quite a few places and cant find anything : Basically, I've made an array, within it are 3 more arrays. Their are two values in each array, 'Name' and 'Age'. Basically I am using a While statement to try and cycle through the 'age' value of my array and state whether or not the person is eligible. (I am actually just learning so I'm doing this to just test myself).

Here is my code
Code:
<?php
$people =array(
array('name' => 'Bob', 'age' => 15 ),
array('name' => 'Jhon' , 'age' => 10),
array('name' => 'Sue' , 'age' => 7));
//($value =& $people[0,1,2][age] );

Here was an attempt to try and create a reference to age, I tried it many different ways
while($age < 10) {
echo ('$name, is eligible') ; } ?>

Okay, so I tried to do this through two ways, one way I tried to create a reference to age, then evaluate it, without that line of code their would be no reference, which way is correct, why wont it work? I am using Xammp, so when I launch local host I get an undefined variable error. What To Do?

View 3 Replies View Related







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