Sponsored Content
Top Forums Shell Programming and Scripting [csh] How to capture output from a command and pass it on to a variable? Post 302193838 by JCR on Sunday 11th of May 2008 09:11:53 AM
Old 05-11-2008
try using the backtick `
listfiles=`ls *.aaa`
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pass csh variable to Perl

Hi All, I am trying to put the csh variable into a perl. In the below case, i am trying to put the csh variable "var" into my perl code. I tried to use '"$var"' but i don;t think it works. Can anybody help me pls? #!/bin/csh set var = `echo "xxx"` perl myperlcode.pl file ... (9 Replies)
Discussion started by: Raynon
9 Replies

2. Shell Programming and Scripting

How to pass enviroment variable from csh to Informix sql script

Hello, I have a csh script that creates an environment variable. I want to pass the environment variable(CURR_TABLE_DATE) to an Informix sql script. Here is the csh: #!/bin/csh -f setenv INFORMIXSERVER market3_tcp setenv CURR_TABLE_DATE 20090714 set DATABASE = gm_cdr set SQL_DIR =... (0 Replies)
Discussion started by: jwoj
0 Replies

3. Shell Programming and Scripting

Enter the command to capture output--help

&& echo "PLEASE enter the command to capture output" || echo "Processing your command manual" x=$# echo $x while do while man $@ | read -r line do >$@.txt ... (1 Reply)
Discussion started by: rrd1986
1 Replies

4. Programming

capture the output of printf into another variable

Hi , I wonder if in java I can pipe the below output of the printf into a variable: System.out.printf(" This is a test %s\n", myVariable); I want to keep the output of the printf command to create my history array. Thanks. (2 Replies)
Discussion started by: arizah
2 Replies

5. Solaris

How to capture Output of truus command

Hi I want to check if some process is sleeping. I can see that in truss -p <pid> I want to capture output and check that output if proces sis sleeping. Please suggest way to capture output of truss command or other way to check if process is sleeping (1 Reply)
Discussion started by: ankush_mehra
1 Replies

6. Shell Programming and Scripting

cannot pass a echo output to a variable in bash

Hi, I have a problem with passing a echo output into a variable in bash file='1990.tar' NAME='echo $file | cut -d '.' -f1'; echo $NAME the result is echo $file | cut -d . -f1 however with this one,#!/bin/bash file='1990.tar' echo $file | cut -d '.' -f1 the result is what I... (2 Replies)
Discussion started by: 1988PF
2 Replies

7. UNIX for Dummies Questions & Answers

Capture Multiple Lines Into Variable As Of Standard Output

Hello All, I have the below script and output. cat test.sh #!/bin/bash -x logit() { echo " - ${*}" > ${LOG_FILE} } LOG_FILE=/home/infrmtca/bin/findtest.log VAR=`find . -type f -name "*sql"` logit $VAR Output: cat /home/infrmtca/bin/findtest.log -... (9 Replies)
Discussion started by: Ariean
9 Replies

8. Shell Programming and Scripting

How to capture system() function output in variable

How to capture system() function output in awk variable and the print that awk variable..... (8 Replies)
Discussion started by: bharat1211
8 Replies

9. Homework & Coursework Questions

How to Dynamically Pass Parameter to plsql Function & Capture its Output Value in a Shell Variable?

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: 2. Relevant commands, code, scripts, algorithms: #! /bin/ksh v="ORG_ID" ... (2 Replies)
Discussion started by: sujitdas2104
2 Replies

10. Shell Programming and Scripting

How to read the output of a command line by line and pass it as a variable?

Hi, I have some 2000 names in a table like below. Java Oracle/SQL ANSI SQL SQL,DWH,DB DB&Java And by using for loop in my code i am able to get a single word but if there is any special character or space then it is considering as a next line. I have to execute the below queries in... (10 Replies)
Discussion started by: Samah
10 Replies
ESCAPESHELLCMD(3)							 1							 ESCAPESHELLCMD(3)

escapeshellcmd - Escape shell metacharacters

SYNOPSIS
string escapeshellcmd (string $command) DESCRIPTION
escapeshellcmd(3) escapes any characters in a string that might be used to trick a shell command into executing arbitrary commands. This function should be used to make sure that any data coming from user input is escaped before this data is passed to the exec(3) or system(3) functions, or to the backtick operator. Following characters are preceded by a backslash: #&;`|*?~<>^()[]{}$, x0A and xFF. ' and " are escaped only if they are not paired. In Windows, all these characters plus % are replaced by a space instead. PARAMETERS
o $command - The command that will be escaped. RETURN VALUES
The escaped string. EXAMPLES
Example #1 escapeshellcmd(3) example <?php // We allow arbitrary number of arguments intentionally here. $command = './configure '.$_POST['configure_options']; $escaped_command = escapeshellcmd($command); system($escaped_command); ?> Warning escapeshellcmd(3) should be used on the whole command string, and it still allows the attacker to pass arbitrary number of argu- ments. For escaping a single argument escapeshellarg(3) should be used instead. SEE ALSO
escapeshellarg(3), exec(3), popen(3), system(3), backtick operator. PHP Documentation Group ESCAPESHELLCMD(3)
All times are GMT -4. The time now is 11:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy