Sponsored Content
Top Forums Shell Programming and Scripting Xargs to call python executable to process multiple bam files Post 303042318 by RudiC on Saturday 21st of December 2019 09:00:10 AM
Old 12-21-2019
xargs is used to turn a stream on stdin into command line arguments / parameters. sh expects its commands on stdin. Try without xargs, like
Code:
echo "..." | sh


Or, use your .py as the xargs' command but make sure it will be interpreted by python (by defining the correct "shebang").
This User Gave Thanks to RudiC For This Post:
 

9 More Discussions You Might Find Interesting

1. Programming

function call in executable

Hi, I want to write a program in C or in Perl which will tell me that a function is called in which executables. I tried to use the unix command like 'nm', 'strings' and so on to find out whether a function is called in that executable or not but could not able to find a clue. The whole... (1 Reply)
Discussion started by: rocky_74
1 Replies

2. UNIX for Dummies Questions & Answers

How do I Process Multiple Files

Hi, First post here. In Mac OSX terminal I need to run a program against multiple files in a directory and append the output to tab separated variable file. I currently type the following to process just one file MBP:/Users/dc1743/Desktop/SFT root# ./myprogram myfile1.plist >>... (1 Reply)
Discussion started by: dc1743
1 Replies

3. Shell Programming and Scripting

Need to call an Executable (.exe) using shell

Hi all , I need to call an executable (.exe) using shell script. Actual need is i need to call that shell script and do an export of some tables is there any way . the executable is datamover Please let me know if there are any option !! (2 Replies)
Discussion started by: raghav1982
2 Replies

4. Shell Programming and Scripting

Unable to call executable from script

Now I am using the HP-UX11.11 version. The scripts are runninh in KSH shell. While I wan to call one executable of any Pro*C file, I have got the following error, however the executable is running fine directly. testpri Started at 10.05.200923:40 /usr/lib/dld.sl: Bad magic number for... (0 Replies)
Discussion started by: priyankak
0 Replies

5. Programming

how to call c executable inside c program??

hi guys i have only basic knowledge of c so guys plz help me ..... i want 2 call c executable which requires file name as argument and i need to modify file contents before calling that executable now my question is how can i call this c executable inside another c program with arguments ?? i... (9 Replies)
Discussion started by: zedex
9 Replies

6. Programming

Call a C programming executable inside a C program

hi guys i have only basic knowledge of C so guys plz help me ..... is C language support call the C executable inside the C ?? example contect mainA.c have a many function define in the struct,when i compile mainA and make a executable the name is ( A ),can i use executable C inside the C... (5 Replies)
Discussion started by: isnoname
5 Replies

7. Shell Programming and Scripting

Make multiple awk files into an executable

Hello everyone, The following are my input files. The following are my sequence of steps. Can someone please let me know about how to make these bunch of steps into a single script so that I start the script with 1.txt and 2.txt, after execution gives me the final... (11 Replies)
Discussion started by: jacobs.smith
11 Replies

8. UNIX for Advanced & Expert Users

How to process multiple files parallely

Hi, I have a requirement to process multiple files in a directory parallely.Consider the below scenario: In a directory there are three files file1,file2 and file3.When I use for loop each file will be executed in sequence but I want to process parallely. Any Help would be appreciated.... (1 Reply)
Discussion started by: liyakathali
1 Replies

9. Shell Programming and Scripting

Bash script with python slicing on multiple data files

I have 2 files generated in linux that has common output and were produced across multiple hosts with the same setup/configs. These files do some simple reporting on resource allocation and user sessions. So, essentially, say, 10 hosts, with the same (2) system reporting in the files, so a... (0 Replies)
Discussion started by: jdubbz
0 Replies
SHELL-QUOTE(1p) 					User Contributed Perl Documentation					   SHELL-QUOTE(1p)

NAME
shell-quote - quote arguments for safe use, unmodified in a shell command SYNOPSIS
shell-quote [switch]... arg... DESCRIPTION
shell-quote lets you pass arbitrary strings through the shell so that they won't be changed by the shell. This lets you process commands or files with embedded white space or shell globbing characters safely. Here are a few examples. EXAMPLES
ssh preserving args When running a remote command with ssh, ssh doesn't preserve the separate arguments it receives. It just joins them with spaces and passes them to "$SHELL -c". This doesn't work as intended: ssh host touch 'hi there' # fails It creates 2 files, hi and there. Instead, do this: cmd=`shell-quote touch 'hi there'` ssh host "$cmd" This gives you just 1 file, hi there. process find output It's not ordinarily possible to process an arbitrary list of files output by find with a shell script. Anything you put in $IFS to split up the output could legitimately be in a file's name. Here's how you can do it using shell-quote: eval set -- `find -type f -print0 | xargs -0 shell-quote --` debug shell scripts shell-quote is better than echo for debugging shell scripts. debug() { [ -z "$debug" ] || shell-quote "debug:" "$@" } With echo you can't tell the difference between "debug 'foo bar'" and "debug foo bar", but with shell-quote you can. save a command for later shell-quote can be used to build up a shell command to run later. Say you want the user to be able to give you switches for a command you're going to run. If you don't want the switches to be re-evaluated by the shell (which is usually a good idea, else there are things the user can't pass through), you can do something like this: user_switches= while [ $# != 0 ] do case x$1 in x--pass-through) [ $# -gt 1 ] || die "need an argument for $1" user_switches="$user_switches "`shell-quote -- "$2"` shift;; # process other switches esac shift done # later eval "shell-quote some-command $user_switches my args" OPTIONS
--debug Turn debugging on. --help Show the usage message and die. --version Show the version number and exit. AVAILABILITY
The code is licensed under the GNU GPL. Check http://www.argon.org/~roderick/ or CPAN for updated versions. AUTHOR
Roderick Schertler <roderick@argon.org> perl v5.8.4 2005-05-03 SHELL-QUOTE(1p)
All times are GMT -4. The time now is 09:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy