shell

Custom interactive shell

I've run into the following problem: My console utility should be running as a process (hope it's the right term) so every command goes to it directly. Like gnuplot, interactive shells (irb, etc.). This shows what I'm talking about: Mikulas-Dites-Mac-2:Web rullaf$ command Mikulas-Dites-Mac-2:Web rullaf$ irb >> command NameError: undefi...

Run external program with PHP CLI

Hi Folks, I wish to create a shell "Menu" Instead of using bash for my script, I wish to use PHP. Is it possible to run an external program using php, that will interact with the user? For example, let's say I wanted the php script to run /bin/bash (Just an example), but then when exiting bash, got back to the start of the script (i.e...

Why 'x' used in [ x"$VAR" = x"VALUE" ] ?

I can see in unix shell scripts that following construction used [ x"$VAR" = x"VALUE" ] instead of [ "$VAR" = "VALUE" ] Why? ...

antiword shell command does not work correctly through PHP

I called antiword in the shell using putty and it worked fine. However, when i call it using shell_exec() it always gives empty string. Here is the code I used: $file="IS_BT_KLVZ_MSI_001.doc"; $content=shell_exec("/usr/local/bin/antiword /usr/local/apache/htdocs/dokuman_sorgusu/documents/$file"); var_dump($content); In one forum, I s...

Problems with shell-script while!

First of all, I'm a beginner on shell-script. This code I've done is not working. I want to repeat a code for 30 seconds but it doesn't work. It just keep doing my logic indefinitely. DIFF=0 while [ $DIFF < 30 ]; do START=$(date +%s) ######## My logic ######### DIFF=$(( $END - $START )) echo $DIFF cd .. sleep 5...

Permission denied on PHP as a shell script

I'm trying to follow the instructions here: http://www.php.net/manual/en/features.commandline.usage.php I created a file named "vardump" Added this code to the file: #!/usr/bin/php <?php var_dump($argv); ?> did chmod +x vardump but I'm getting a permission denied error when executing the file: shiki@Etna:~/projects/tests$ ./vardump ...

Make sure Apache user is allowed to use shell

Hello, how can I make sure that Apache/web server user is allowed to execute shell commands? I would like to execute a shell command in PHP script but it doesn't work for some reason (it works when written manually in shell by hand, of course, so the command is surely correct). I believe the problem is that the user PHP is running under...

Shell Scripting - check java bin

On a unix machine, how can I write a shell script for checking if 'java bin' directory has been included in $PATH env. variable? ...

MacVim - executing a shell script not working..?

Hello all, I have written a custom shell script function, and put in in my .profile. When I run the command that executes the function from my terminal, it works just fine, however when I run the command from MacVim, it does nothing. The function in my .profile is not being run when I run the command from Macvim. How to I get this to...

Bash: Concatenate all arguments and wrap them with double quotes

function foo() { A=$@... echo $A } foo bla "hello ppl" I would like the output to be: "bla" "hello ppl" What do I need to do instead of the ellipsis? ...

How to show a popup without a browser

I need an "alert" type feature to troubleshoot an error. I am not using a browser and using javascript as windows administaration purposes. So is their a way to view a varibales value if I am not using a browser? ...

Emacs ... as your default shell?

Is it possible instead of loading /bin/bash, for my terminal to load emacs or emacsclient when I open it up, with a session for eshell? And is it feasible to ssh->screen from an emacs session without running into problems? I want to do this purely to learn about emacs being as I like it so much. No hate text, etc please :) ...

Export PYTHONPATH - syntax error.

I need to connect MySQLdb - module. I download MySQLdb - module and install it. But when i write (in python interactive shell): import MySQLdb - i get no module named MySQLdb. Then i decided to include MySQLdb directory in PYTHONPATH variable. I write (in python interactive shell): export PYTHONPATH=${PYTHONPATH}:/where/module/live...

How can I import the enviroment variables of a completed process in python?

I need to write a python script that launches a shell script and import the environment variables AFTER a script is completed. Immagine you have a shell script "a.sh": export MYVAR="test" In python I would like to do something like: import os env={} os.spawnlpe(os.P_WAIT,'sh', 'sh', 'a.sh',env) print env and get: {'MYVAR'="test"...

Subversion Help?

I have a project that I've checked into my SVN repo. Now I've created a second version of the project located in a different folder. I want to check this folder in as well, without interfering with the original project. Looking at my repo, it doesn't look as though I have the typical trunk/branches/tags folders, for whatever reason. So, ...

Bookmark Directories In Terminal

Looking for a solution to quickly navigate to long paths in a shell (particularly Max OS X Terminal.app). Say my path is ~/This/Is/A/Really/Long/Path/That/I/Would/Rather/Not/Type/Frequently Instead of cd ~/This/Is/A/.... I would like to be able to store favorites/bookmark directories so I could do "cd myPath" Are there any binaries o...

How to change the connection string with sed

Hello, guys! I have a connection string in a ini file as following: 1 ... 2 ... 3 #someline: n ConnectionString = "Data Source=localhost;Database=grid;User ID=grid;Password=grid;" And I would like to locate to the line n and replcate Data Source, Database, User Id and Password field. So how can I make it in sed? ...

Question about how to make a filter using script

Hello everyone, I'm trying to make a filter on script to make this happen: Before: 123.125.66.126 - - [05/Apr/2010:09:18:12 -0300] "GET / HTTP/1.1" 302 290 66.249.71.167 - - [05/Apr/2010:09:18:13 -0300] "GET /robots.txt HTTP/1.1" 404 290 66.249.71.167 - - [05/Apr/2010:09:18:13 -0300] "GET /~leonardo_campos/IFBA/Web_Design_Aula_17.pdf ...

Writing A Fish Shell Script With an Optional Argument

I have a fish shell script whose default behavior is to send an email when complete. I'd like to modify it to respond to a nomail argument from the command line. So, for example, running the script normally would produce an email: michaelmichael: ~/bin/myscript But if run with the nomail switch, it wouldn't send the confirmation email:...

adb rejected shell command (ls -l)

Possible Duplicate: ADB rejected shell command (ls -l /data) Hi.. When I am trying to push any file in sdcard from my android application. I see message from ddms " ADB rejected shell command (ls -l/) ". And My Emulator is dead, I cant do anything. Please help me.. ...