|
How do I redirect stdin from a shell script to a command in the shell script? I am trying to pass the stdin to a java System.in stream.
I want to replace
find . -type f | $JAVA_HOME/bin/java com.domain.BatchProcess
with
find . -type f | ./batch.sh
Started by jon077 on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
If you exec the command within the script, it will replace the shell and inherit it's file/java com.domain.BatchProcess
is expecting input from stdin, then putting it in a script and running.
|
|
Basically I need to run the script with paths related to the shell script file location, how can I change the current directory to the same directory as where the script file resides?
Started by goodwill on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Assuming you're using bash
#!/bin/bash current_dir=$(pwd) script_dir=$(dirname $0) echo $current_dir echo $script_dir
This script, when ran, should print the directory that you're in, and then the directory the script is ....
|
|
I've been Googling and Overflowing for a bit and couldn't find anything usable.
I need a script that monitors a public folder and triggers on new file creation and then moves the files to a private location.
I have a samba shared folder /exam/ple/ on ...
Started by CheeseConQueso on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
Files) { # Move file move("$dirname/$target", "$dest_dir/$target"); # Trigger external Perl script than incron due to pyinotify is pure Python event-driven -- less impact than the perl script autocmd.py.
|
Ask your Facebook Friends
|
I'm trying to write a shell script that, when run, will set some environment variables that will stay set in the caller's shell.
setenv FOO foo
in csh/tcsh, or
export FOO=foo
in sh/bash only set it during the script's execution.
I already know that
source...
Started by Larry Gritz on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
shell terminal settings used to be done: a script would output statments to be executed in the login a script file is the most commonly used method for configuring a shell environment, you may just -i
If the script ....
|
|
If I'm writing a shell script and I want to "source" some external (c-)shell scripts to set up my environment, I can just make calls like this:
source /file/I/want/to/source.csh
I want to replace a shell script that does this with a ruby script. Can I...
Started by Charlie on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
What you can't variables in your ruby script, not set them in your shell (since they're forgotten as soon as the rubyThis looks like....
Execute ruby-script and then execute (in the shell process) the output of the script.
|
|
Running Fedora 9/10, Apache 2, PHP 5...
Can I run a shell script as root, from a PHP script using exec()?
Do I just give Apache root priveleges, and then add "sudo" in front of them command?
Specifically, I'm trying to start and stop a background script...
Started by SkippyFire on
, 7 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
So make sure that ....
Even then, it poses a security risk, because anyone could create a PHP script and run your shell script in turn.
Your shell script).
The apache user to that single command you wish to run (i.e .
|
|
Hello
I have just migrated to a UNIX workstation. My memory of Bash shell scripts has faded since school and I find the syntax to be highly confusing. I am wondering what other scripting languages are used to automate tasks. The two most popular ones ...
Started by Scott Davies on
, 11 posts
by 11 people.
Answer Snippets (Read the full thread at serverfault):
Sh (bourne shell , a replacement for the usnix shell with ruby syntax and do things like this:
local = Rush::Box.new machines via script became reality....
On the web for learning it, not to mention code that you can copy and re-purpose .
|
|
Is it possible to run Perl script (vas.pl) with shell sript inside (date.sh & backlog.sh) in cron or vice versa? Thanks.
0 19 * * * /opt/perl/bin/perl /reports/daily/scripts/vas_rpt/vasCIO.pl 2> /reports/daily/scripts/vas_rpt/vasCIO.err
Error encountered...
Started by Cez on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
:
# I'm assuming your shell script reside in the same # dir as your perl script: system("sh /reports package from CPAN:
use FindBin qw($Bin); system("sh $Bin/date.sh");
If your shell script also needs in the correct ....
|
|
Please recommend a good book to start with the shell scripting and then going ahead to have in depth and precise knowledge of shell scripting.
Started by Sachin Chourasiya on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Beginning....
And design shell script portably from the ground up How to use programmable utilities Guide , An in-depth exploration of the art of shell scripting Learning the Bash Shell is a great to go to a previous page.
|
|
I've a python script that has to launch a shell command for every file in a dir:
import os files = os.listdir(".") for f in files: os.execlp("myscript", "myscript", f)
This works fine for the first file, but after the "myscript" command has ended, the...
Started by Davide Gualano on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) process.wait() print process.returncode
use.
|