Sponsored Content
Top Forums Shell Programming and Scripting problem redirecting output of command to variable Post 302223087 by nunovc on Friday 8th of August 2008 09:50:37 AM
Old 08-08-2008
problem redirecting output of command to variable

Hi. I'm a newbie in scripting and i have this problem: i want to use the 'fuser' command on a file to tell if it's being accessed (for my purposes: still being written). I want to save the output of the command and later compare with the 'not being used' result.

the script:

#!/bin/bash
TATA='ii'
echo 'TATA before: '$TATA
TATA=`fuser LockedFiles/deals.csv`
echo 'TATA after: '$TATA

However, the result of the above code is:

-bash-3.00$ script.sh
TATA before: ii
LockedFiles/deals.csv:
TATA after:

So the output of the command is not going to the variable but to the screen (altough the variable value is erased) and I can't figure out why! Can you help me?

Thanks,

Nuno
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Command output to a variable.

With cut -c 8-13 myfile, I am getting some numeric value. In my shell script I am trying to assign something like this, var=cut -c 8-13 myfile But at the time of execution I am getting -c is not found. If I dont assign, then script executes well. Can we not simply use the value from one... (8 Replies)
Discussion started by: videsh77
8 Replies

2. UNIX Desktop Questions & Answers

problem while storing the output of awk to variable

Hi, i have some files in one directory(say some sample dir) whose names will be like the following. some_file1.txt some_file2.txt. i need to get the last modified file size based on file name pattern like some_ here i am able to get the value of the last modified file size using the... (5 Replies)
Discussion started by: eswarreddya
5 Replies

3. Shell Programming and Scripting

Redirecting output of a command to a file

Hi We are having a requirement where one shell script, say a.sh (which uses Java and connects to Oracle database using JDBC) keeps on running everytime. I created a wrapper (to check whether a.sh is running and if not then to start it) and scheduled it in the crontab. Now all the output from... (3 Replies)
Discussion started by: ankitgoel
3 Replies

4. Programming

Command output into a variable

Hi, with this command: cu -l /dev/ttyACM0 -s 9600 > name.txt I put the output of the port in a txt Is posible to do the same (or similar) in a var directly, inside a C program? cu -l /dev/ttyACM0 -s 9600 > variable ? I have trying this withs pipes, but i dont know how to... (6 Replies)
Discussion started by: daaran
6 Replies

5. Shell Programming and Scripting

Redirecting output that was redirected to variable and console

Hi all, I would like to store the output of a command in a variable and output it to the console at the same time. This is working fine using the following construct var=`command | tee /dev/tty` I use this in some scripts to display the output of the command on the console and, at the same... (2 Replies)
Discussion started by: script_man
2 Replies

6. Shell Programming and Scripting

Redirecting command output as well as commands

I have a Bourne Shell script that is normally run as a background job and redirects it's output to a file internally (using exec >>); I use "set -x" to capture each command which provides me with a nice shell execution log if it all goes to pieces. I now also need to be able to also run this as... (4 Replies)
Discussion started by: AncientCoder
4 Replies

7. Shell Programming and Scripting

date output store in variable problem

When I run following command date Output1 => Thu Sep 9 03:26:52 IST 2010 When I store in a varibale as a=`date` echo $a output2 => Thu Sep 9 03:27:02 IST 2010 The differnece is, it is trimming the space when I am storing the output in varibale. Output1 = Thu Sep 9 03:26:52 IST 2010... (2 Replies)
Discussion started by: pravincpatil
2 Replies

8. Shell Programming and Scripting

Redirecting command output to a file in a shell script

Hello All, I have some unique requirement. I have written a very lengthy script which calls number of resource script to execute a particular task. What I want is output of each command(called from main script and resource scripts) should go to a... (3 Replies)
Discussion started by: anand.shah
3 Replies

9. Linux

RHEL 6.3 - chage command not redirecting the output to console.

When i am issuing chage command, it reporting the output properly. But when i redirect the output, i am not getting the output in the mentioned path. chage -l root >> /tmp/chage.txt. I need to use this into the script to capture the data. I think its seems to be bug with RHEL 6.3. Same... (3 Replies)
Discussion started by: Srini.rk1983
3 Replies

10. Programming

Redirecting output to new file for command "perldoc perllocal"

Hi, I have to redirect output of the command "perldoc perllocal" to new file which contains all the perl module installed. Currently using perldoc perllocal >> mod_data This does not contain all perl modules installed locally on machine, and each character is doubled. Please... (3 Replies)
Discussion started by: asak
3 Replies
GLAM2(1)							   glam2 Manual 							  GLAM2(1)

NAME
glam2 - Gapped Local Alignment of Motifs SYNOPSIS
glam2 [options] alphabet my_seqs.fa An alphabet other than p or n is interpreted as the name of an alphabet file. DESCRIPTION
GLAM2 is a software package for finding motifs in sequences, typically amino-acid or nucleotide sequences. A motif is a re-occurring sequence pattern: typical examples are the TATA box and the CAAX prenylation motif. The main innovation of GLAM2 is that it allows insertions and deletions in motifs. OPTIONS (DEFAULT SETTINGS) -h Show all options and their default settings. -o Output file (stdout). -r Number of alignment runs (10). -n End each run after this many iterations without improvement (10000). -2 Examine both strands - forward and reverse complement. -z Minimum number of sequences in the alignment (2). -a Minimum number of aligned columns (2). -b Maximum number of aligned columns (50). -w Initial number of aligned columns (20). -d Dirichlet mixture file. -D Deletion pseudocount (0.1). -E No-deletion pseudocount (2.0). -I Insertion pseudocount (0.02). -J No-insertion pseudocount (1.0). -q Weight for generic versus sequence-set-specific residue abundances (1e+99). -t Initial temperature (1.2). -c Cooling factor per n iterations (1.44). -u Temperature lower bound (0.1). -p Print progress information at each iteration. -m Column-sampling moves per site-sampling move (1.0). -x Site sampling algorithm: 0=FAST 1=SLOW 2=FFT (0). -s Seed for pseudo-random numbers (1). SEE ALSO
glam2format(1), glam2mask(1), glam2-purge(1), glam2scan(1) The full Hypertext documentation of GLAM2 is available online at http://bioinformatics.org.au/glam2/ or on this computer in /usr/share/doc/glam2/. REFERENCE
If you use GLAM2, please cite: MC Frith, NFW Saunders, B Kobe, TL Bailey (2008) Discovering sequence motifs with arbitrary insertions and deletions, PLoS Computational Biology (in press). AUTHORS
Martin Frith Author of GLAM2. Timothy Bailey Author of GLAM2. Charles Plessy <plessy@debian.org> Formatted this manpage in DocBook XML for the Debian distribution. COPYRIGHT
The source code and the documentation of GLAM2 are released in the public domain. GLAM2 1056 05/19/2008 GLAM2(1)
All times are GMT -4. The time now is 01:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy