shell

Shell script code browser

Is there a shell script code browser like ctags for c? Probably not I think, a recommended editor for shell script code browsing would also do. ...

Rscript: Define path file as argument

I try this command : Rscript "/Users/test/Scripts/arg_test.R" "path_in=/Users/test/GR/web-app/Rproject/Inputs/Rmerge/Description.csv" path_in2="/Users/test/IdeaProjects/Rproject/Inputs/Rmerge/Template_Auto.csv" but I have this error : Error in parse(text = args[[i]]) : unexpected '/' in "path_in=/" Part of Rscript : args=(commandArg...

Export a variable from PHP to shell

I'm trying to set a variable that should be accessible from outside PHP. Ideally this should be a local variable, but environment variables are also welcome. First, I've tried putenv(), but this gives no result: $ php -r "putenv('PHP_TEST=string');" ; echo $PHP_TEST $ When i call getenv() from the same script — it results in ...

How can I run a shell script from inside a Perl script run by cron?

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: date.sh: not found backlog.sh: not found Perl script: #!/opt/perl/bin/per...

Long lines all messed up on a console application

I'm trying to use a text-to-speech engine, festival, in Windows. I found a pre-compiled binary online, so I can't really re-compile without a whole lot of effort. Here's what happens. I run the program from cmd.exe and try to see the definition for a function: festival> utt.synth #<CLOSURE (utt) (begin "(utt.synth UTT) The main ...

cakephp: using l10n in cake console

Hi, As per subject, I would like to be able to use __() function call in my cakephp shell. I've tried importing l10n to the shell to no avail App::import('Core', 'l10n'); Any help is appreciated, many thank's! EDIT: I will probably add more info. The __() call is successful, but it's outputting the input string instead of translat...

Do a complete flux of work on bash script

Hey there ! I'm trying to automate a proces which I have to do over and over again in which I have to parse the output from a shell function, look for 5 different things, and then put them on a file I know I can match patterns with grep however I don't know how to store the result on a variable so I can use it after :( I also have to p...

[SHELL SCRIPT] echo removing backslash characters

Hi, I am trying to write a script which parses the fields in the program and prints them to standard output. Input file data is like this field1 field2 Fields are separated by tabs Initially, I tried to write it in AWK. cat test.txt | while read line; do entity=`awk -F "\t" '{print $2}'`;echo $entity; done This works fine on comm...

From Shell: Delete all files with apostrophes

How do I delete all files in a folder that has an apostrophe? for example: Baird/'s Tunnel.jpg Bach/'s Birds.jpg This isn//'t good.png I would like all those files deleted but anything that doesn't have an apostrophe to remain intact, like: this is good.jpg donotdelete.png ...

adding or changing variable value

I want to add the following line to /etc/my.cnf server-id=1789051 The line may or may not be there. If it is there, it is usually server-id=1 If my IP is 192.178.90.51 then the server id should be 1789051 I want to know if a shell script or a command can do it. ...

csh different from bash when expend *NAME* patten to file name list.

I am a newbie for shell script. I noticed that for command like: tar cf test.tar *TEST* *TEST2* sh and bash will expand TEST to a list of file names, while csh will not. I want the shell not to expend, how can I do this? Use ' or " will lead to other problems. If there is files match pattern *TEST*, but no files match *TEST2*, then...

GPG key import through PHP not working (works in shell)

Hello, I have to import a GPG key in a PHP script, it works using the commande line gpg --import "/home/me/pubkey.txt" but does not work using the PHP gpg class with the import method even with the gnupg_import function. My configuration is : RedHat Enterprise Linux 5 PHP 5.1.6 GnuPG 1.4.5 GPGme 1.1.8 GPG extension 1.3.1 I also...

Diff files present in two different directories

I have two directories with the same list of files. I need to compare all the files present in both the directories using the diff command. Is there a simple command line option to do it, or do I have to write a shell script to get the file listing and then iterate through them? Thanks! ...

shell script execution error in uclinux

Hi, I have a simple shell script as follows: myfunc() { #print hello world echo "Hello World"; } myfunc The script works fine when I execute in linux pc but when I run the same in uclinux, I get the error as "syntax error". What could be reason for the problem? ...

Problem with SendMessage

Hello friends, I am developing an application using C# having similar functionality of copy,paste as in Windows. I have added menu items and linked with respective applications. Please look at the following image for getting more idea. Like we select multiple items in windows explorer, you need to select multiple files and/or folde...

How to extract substring from a text file in bash?

I have lots of strings in a text file, like this: "/home/mossen/Desktop/jeff's project/Results/FCCY.png" "/tmp/accept/FLWS14UU.png" "/home/tten/Desktop/.wordi/STSMLC.png" I want to get only the file names from the string as I read the text file line by line, using a bash shell script. The file name will always end in .png and will al...

Why does set -e cause my script to exit when it encounters the following?

Hi All, I have a bash script that checks some log files created by a cron job that have time stamps in the filename (down to the second). It uses the following code: CRON_LOG=$(ls -1 $LOGS_DIR/fetch_cron_{true,false}_$CRON_DATE*.log 2> /dev/null | sed 's/^[^0-9][^0-9]*\([0-9][0-9]*\).*/\1 &/' | sort -n | cut -d ' ' -f2- | tail -1 ) if ...

understanding a ksh script part of

Hi Could someone help me understand the following piece of code which is deciding on the start and end dates to pick data out of a db. # Get the current time as the stop time. # stoptime=`date +"%Y-%m-%d %H:00"` if test $? -ne 0 then echo "Failed to get the date" rm -f $1/.optpamo.pid exit 4 fi # # Read the lasttime file to ...

What is '$$' in the bash shell?

I'm beginner at bash shell programming. Can you tell me about '$$' symbols in the bash shell? If I try the following #> echo $$ it prints #>18756 Can you tell me what this symbol is used for and when? ...

traping shell exit code

Hi there, I am working on a shell script, and want to handle various exit codes that I might come across. To try things out, I am using this script: #!/bin/sh echo "Starting" trap "echo \"first one\"; echo \"second one\"; " 1 exit 1; I suppose I am missing something, but it seems I can't trap my own "exit 1". If I try to trap 0 every...