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


ADVERTISEMENT

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

Ubuntu :: Using Shell - Mailing Myself LS (or Any) Outputs

Oct 27, 2010

I have been having some fun with the shell but have become a little lost. I want to be able to email (myself and others) outputs from various commands etc. Sometimes people wish to know the contents of my music library etc and it's nice to be able to ssh in and email an ls (or similar) output.

Here is what I have been doing:
Code:
ls -R /home/simon/mount/sata0/audio > /tmp/musiclist
mail -s $(date +%Y%m%d) email@domain.com < /tmp/musiclist
The date part works perfectly and I receive an email with a subject suiting my preferential YYYYMMDD format.

But what I'd like to figure out is how to get this into a single line of code, my first attempt was:
Code:
mail -s $(date +%Y%m%d) email@domain.com < $(ls -R /home/simon/mount/sata0/audio)
This generates an error:
-bash: $(ls -R /home/simon/mount/sata0/audio): ambiguous redirect
But if I simply run the code "ls -R /home/simon/mount/sata0/audio" - the output is exactly what I want.

Is what I'm trying to do even possible? I do realise that I could use something like this
Code:
ls -R /directory > /tmp/file && mail -s $(date +%Y%m%d) email@domain.com < /tmp/file
But this is still running two commands and I'd like to figure out how to be 'cleverer'.

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

Programming :: Shell Script - Which Should Diff Between PS Outputs

Feb 16, 2010

I would like to make a one-liner, which diff's "ps aux" output before and after killing a process. So basically it should be a combination of fallowing commands:
1) diff -u
2) ps aux | awk '{print $2}'
3) kill `ps aux | grep [c]ron | awk '{print $2}'`
4) ps aux | awk '{print $2}'

How to achieve this? Something like this:
Code:
diff $( kill `ps aux | grep [c]ron | awk '{print $2}'` && ps aux | awk '{print $2}' ) $( ps aux | awk '{print $2}' )
I don't have pgrep or pkill available.

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

Programming :: Requesting Shell Script That Only Outputs Directories That Contain Subdirectories?

Jan 7, 2010

I have a directory that has about 5,000+ folders in it and I'd like to run a script that outputs any directory that contains a subdirectory.

View 4 Replies View Related

Programming :: Shell Script With HTML Formatting?

Jan 9, 2010

I have a script that presents download link, but it shows download links in one line.How do I get it to show each link in its own line?

my $message_text =
join "
",

[code]...

View 9 Replies View Related

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

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

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

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

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

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 :: Redirect All Outputs From /dev/console To /dev/pts/0?

Aug 9, 2010

The serial console is for debugging and will physically disappear when product is mature. However, there are many background processes that may print out statuses/results. These go to /dev/console or serial console. Telnet will be the only way to get a console. I tried netconsole (with netcat) and it works, but it is only for kernel printk messages. I tried "program > /dev/pts/0" and it works also. it would be better if I can just change/add the console /dev/pts/0 to the existing /dev/console.

View 3 Replies View Related

General :: Piping Data To Multiple Outputs?

Mar 29, 2011

I remember there was a command that would allow me to pipe data to an app and the use the | operator to pipe it into yet another app.

foo fooArg | Iforget app1 | app2

I forget what this command is but it pipes the data from foo into app1 and app2.

View 3 Replies View Related

General :: Multiple Grep Outputs Appended To Single Row Of CSV File?

Sep 12, 2010

how to update a series of values from multiple grep commands outputs to be appended to a single row of a csv file? Work on a linux envir. The values from grep output will be numeric values.

Output sold look like:

1,3,4,5,7,0,5

Each of these values will be odtained from multiple grep commands piped with wc -l Is it possible to update a single row of a csv file if so pleas ehelp me with the command to be used to redirect the output into the csv file

View 5 Replies View Related

Ubuntu :: Bash Script With Variables And Editing Variables

Apr 6, 2011

mkvmerge -o <filename without extension>_TV.mkv -S <filename> && mkvextract tracks <filename> 3:<filename without extension>.*** && perl /home/brian/Desktop/ass2srt.pl <filename without extension>.*** && rm <filename without extension>.***

Doing these commands for multiple command line file inputs is the goal. So I can just type ./script.sh *.mkv in my terminal.This is what I have so far, but it doesn't work whatsoever.

View 2 Replies View Related

General :: Curl -K Command Outputs Weird Symbols Instead Of Downloading URL From File?

May 16, 2011

I'm on Ubuntu 11.04. I have read around about how to use curl to download a list of URLs from a text file, and everyone says to use Code:curl -K URLlist.txt. This is what the curl man page says as well. However, for even a simple file with one URL, this command outputs a bunch of weird symbols for me instead of downloading the file.For example, I have a text file "test.txt" with one line in the following format:

Code:
url = "http://www.example.com/image.jpg"
I use the curl command to download this file:

[code]....

View 7 Replies View Related

General :: Formatting Op Of Awk Command?

Mar 7, 2011

I have an command to read inputs from file2 and replace the content in file1. Issue is that the op is coming in a single line as gsub and split functions don't recognize new line characters.

Code:
awk 'NR==FNR{gsub(/input./,""); split($0,a," = ");b[a[1]]=a[2];next} {gsub(/@/,"");for (i in b) gsub(i,b[i])}1' $t2 $t3
This gives belwo op:

[Code]....

View 14 Replies View Related

General :: $HOME/.bashrc Disabled When User Shell Is 'rbash' (restricted Shell)?

Jun 15, 2011

MACHINE: HP Proliant DL260G5OS: SLES 11 SP1kernel: Linux xserver 2.6.32.12-0.7-default #1 SMP 2010-05-20 11:14:20 +0200 x86_64 x86_64 x86_64 GNU/LinuxIt is used as remote xserver in a LAN.I have configured /usr/lib/restricted/bin/.rbashrc with some environment variables but when the users logon in the system finally is executed $HOME/.bashrc and some environment vars are overwritten.

View 2 Replies View Related

General :: Formatting A Disk For Macintosh?

Jan 9, 2011

I've been asked to move data from an old external hard drive to a new one, and to make the new one compatible with the Macintosh. (The old drive's USB connection has died, and I'm connecting to old the drive using a PC card that provieds an eSATA to the drive. The recipient's Macintosh doesn't have a PC card slot, so she can't access the old drive anymore. Hence, the new drive.)

Naturally, I'm doing this data transfer using Linux. I've discovered that I can format the drive as HFS+ using mkfs.hfsplus from the hfsprogs package. But I need to know: do I need to do anything special with the partition table? Is there a special Macintosh partition table format that I need to format this disk to? If so, what tools can I use to get the right format for the partition table?

View 1 Replies View Related

General :: Formatting $PS1 To X Amount Of Character?

Jun 22, 2011

I'm looking for a way to force my PS1 variable to a certain number of chars.
It currently looks like:

$PS1="W $"

and I'm trying to keep the same number of characters regardless of the length of current folder name.

For example, both Documents and bin would be displayed as 10 character strings, keeping the left side of my terminal the same width all of the time.

View 1 Replies View Related

General :: Does Not Support Formatting A 3TB Disk

Jun 11, 2011

I bought a 3 TB western digital but I cannot format it. I have to split into 2TB and 1TB (or less because it holds 2.73 TB actually). Is that normal because of linux does not support 3tb yet? I note that I tried into EXT4 and JFS (after tabel creating)

View 1 Replies View Related







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