Hi,
I'm having troubles getting this to work. Basically I have a python program that expect some data in stdin, that is reading it as sys.stdin.readlines() I have tested this and it is working without problems with things like echo "" | myprogram.py
I have a second program that using the subprocess module calls on the first program wit...
Are there any software packages or projects that provide the scripting language shells? I know there's csh for C programmers although not in a sense that it's primarily for programming, but for navigation and system administration. I was wondering if there is something inverted for this purpose? I.e. user logs into a shell that's primari...
Hi there!
I want to execute multiple shell-commands with php's exec command. The commands have to be made sequentially and I want to start them with nohup so it can run in the background and my php-script doesn't have to wait for it to finish.
Here's my script:
$command1="nohup convert -trim +repage pic1.png pic2.png; convert pic2.png -...
Can someone tell me what the difference is between these two conventions for getting the name of the currently running script?
#!/bin/sh
echo $0
echo ${0##*/}
Does the second version strip the path from the script name?
Thanks!
...
In a shell script how would I find a file by a particular name and then navigate to that directory to do further operations on it?
From here I am going to copy the file across to another directory (but I can do that already just adding it in for context.)
Thanks in advance :)
...
I have a command that when run direct on the command line works as expected. It runs for over 30 seconds and does not throw any errors. When the same command is called through a PHP script through the php function exec() (which is contained in a script called by a cron) it throws the following error:
Maximum execution time of 30 seco...
I have a shell script that is used both on Windows/Cygwin and Mac and Linux. It needs slightly different variables for each versions.
How can a shell/bash script detect whether it is running in Cygwin, on a Mac or in Linux?
...
I ran the below script to set environment variables for oracle(oracle_env.sh which comes with oracle package itself).
ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
export ORACLE_HOME
ORACLE_SID=XE
export ORACLE_SID
NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
export NLS_LANG
PATH=$ORACLE_HOME/bin:$PATH
export PATH
if [ $?LD...
I tried to run commands using pipes.
Basic:
single="ls -l"
$single
which works as expected
Pipes:
multi="ls -l | grep e"
$multi
ls: |: No such file or directory
ls: grep: No such file or directory
ls: e: No such file or directory
...no surprise
bash < $multi
$multi: ambiguous redirect
next try
bash $multi
/bin/ls: /bin/ls: c...
I have an compiled executable that is supposed to copy itself from the res folder, and into the /data/data/package-name/ folder, and change the permissions, and then execute. Every step completes all the way to the end. The output stream seems to be writing, etc. Except when I go check the file system, nothing has been done. I first trie...
I am, like many non-engineers or non-mathematicians who try writing algorithms, an intuitive. My exact psychological typology makes it quite difficult for me to learn anything serious like computers or math. Generally, I prefer audio, because I can engage my imagination more effectively in the learning process.
That said, I am trying to...
I'm trying to execute a script from within my java code which looks like:
Process p = Runtime.getRuntime().exec(cmdarray, envp, dir); // cmdarray is a String array
// consisting details of the script and its arguments
final Thread err = new Thread(...); // Start reading error stream
err.start();
final Thread out = new Thread(...); // S...
Is there for the bash something like perls __DATA__?
I mean the feature, that the code after __DATA__ will not be executed.
...
I don't really know what iPhoto's Enhance actually do, so, I guess we could start by finding out exactly what it's doing. I'd wager some mix of auto-levels, sharpen, and color adjustment.
I'd like to, then, do something as similar as possible with the ImageMagick shell tools, or, if need be, with some programming thrown in through a lib...
Is there an equivalent to Python's popen2 in Java?
...
Hi Everyone
I'm wrestling with the concepts behind subprocesses and pipes, and working with them in a Python context. If anybody could shed some light on these questions it would really help me out.
Say I have a pipeline set up as follows
createText.py | processText.py | cat
processText.py is receiving data through stdin, but how i...
Hopefully fairly straightforward, to explain the use case when I run the following command (OS X 10.6):
pwd | pbcopy
the pasteboard contains a newline character at the end. I'd like to get rid of it.
...
In executing the following line in bash:
set -e
p=$(mktemp -t "${1}.$$.XX")
mktemp fails with this message:
+++ mktemp -t cpfs.c.o.5643.XX
mktemp: too few X's in template `cpfs.c.o.5643.XX'
How can I have the error on fail include errors during command substitutions? Alternatively, how can I propagate the return code form mktemp ba...
I have a text file like below
11:00AM JOHN STAMOS 1983-08-07 I like Pizza Hut
12:00AM JACK SPARROW PIRATE 1886-09-07 I like Pizza Hut and DOminoz
11:00AM SANTA 1986-04-01 I like cold beer
How do I sort the above file on the date column? The problem I am facing is due to the variable length name column. Some people have first middle la...
I created a cronjob with the command crontab -e:
*/1 * * * * /var/lib/tomcat/webapps/ROOT/WEB-INF/scripts/test.sh
This file test.sh should be executed every minute. But it doesn't work.
If I run the script manually it works fine. So I think the problem is the cronjob not the script ;)
Are there any permissions or something else w...