shell

Figuring out absolute path of mysql to execute shell script.

How to figure out the mysql location on a server (windows or linux)? I would like to run mysql -u USER -p PASS DATABASE < filename.sql but I need the absolute path to mysql, how do I find out? ...

Tcsh and Bash Initialization

I would like to be able to source a file to set up some environment variables, but do it so it's independent of the shell being used. For example %: source START.env # START.env if [ $SHELL == "bash" ]; then source START.env.bash # sets environment variables else source START.env.tcsh # sets environment variables fi However, t...

How to make tclsh to ignore EOF?

At csh you can do set ignoreeof or at bash tou can do export ignoreeof=1 and this will make csh/bash to ignore EOF, i.e. it will not exit on Ctrl+D, or when it reaches the end or file. Is there a way to make the same with tclsh ? Is there a way to make tclsh not to exit when it reaches the end of file ? ...

resolve Makefile wildcard % inside shell function

hi, it seems that make doesn't resolve the wildcard character % before calling the shell function, in cases like this one: %.exe: $(shell cat %.txt) gcc $? -o $@ if I type this on the shell: $ make test.exe the shell complains that it cannot find "%.txt," but I was expecting it to find "test.txt". is there anyway to workaroun...

How to read input from the stdout of another command (pipe) in linux shell script?

My objective (read Homework) is to find the process that is consuming the most CPU and RAM by writing a script. I've managed to extract the info from TOP command however I'm having trouble parsing the output. The following command top -b -n 1 | tail -n +8 | head -n 1 will output something similar to this single line 915 root ...

How to do this on the tcsh shell in linux

I want to efficiently do the following on the tcsh in Linux. somecommand a; somecommand b; somecommand c; If I do somecommand {a,b,c}, this does somecommand a b c, which is not what I want. Is there a way to do what I want? ...

Parsing using awk or sed in Unix

Hi, I have multiple files with hundreds of thousands of records in following format: 2010/08/10 10:07:52|TrainZoom|1393|38797|MyCustomerAPI->,mask = ZPTA,TransId = 1281460071578,testing :-> , capture -> : , IMDB = 9113290830, equipmentName = GMT, technologyName = RMS,,,)| There are fields separated by pipes and inside...

How to count number of non empty lines in a file using sed?

hi all how to find how many lines I have in file by sed (need to ignore spaces and empty lines) for example if I have file with 139 lines (line can include only one character) then sed should return 139 lidia ...

How to create subdomain into a remote linux server using shell script?

I want to create subdomain from my local machine into a remote server using linux shell script. As I am new in shell scripting, anyone please help me............. ...

What is the best way of running shell commands from a web based interface?

Imagine a web application that allows a logged in user to run a shell command on the web server at the press of a button. This is relatively simple in most languages via some standard library os tools. But if that command is long running you don't want your UI to hang. Again this is relatively easy to deal with using some sort of backgr...

Deleting a broken link Unix

I want to delete a broken link, but before that I want to confirm if the link file is present in directory. Let's call the link A: if [ -a A ] then print 'ya A is ther' fi But if A is a broken link then how can I check? ...

How do you update the Window's Desktop WorkingArea?

Hello, I am developing a security and kiosk library in my framework. The problem here is I have the proper methods and routines to disable various features of the Windows Shell. The main feature I am discussing here is the Windows Taskbar. I have properly disabled, and hid the Windows Taskbar. The problem is that the WorkingArea of the ...

bash script to extract ALL matches of a regex pattern

I found this but it assumes the words are space separated. result="abcdefADDNAME25abcdefgHELLOabcdefgADDNAME25abcdefgHELLOabcdefg" for word in $result do if echo $word | grep -qi '(ADDNAME\d\d.*HELLO)' then match="$match $word" fi done POST EDITED Re-naming for clarity: data="abcdefADDNAME25abcdefgHELLOabcdefgAD...

CakePHP shell as a Cron Job not working on godaddy

Hello, I have developed a application in CakePHP, and setup a cron Job with Shell. I have hosted the application in our development server, bluehost and setup the cron Job and its working fine. The cron Job Command was, /home4/enventur/public_html/pennystock/cake/console/cake -app "/home4/enventur/public_html/pennystock/app" message_...

How do command-line interpreters work?

I have been under the impression that processes on the operating system have three standard streams: stdin, stdout, and stderr. I have also thought that text editors like vim work by taking input over stdin and sending ANSI escape characters over stdout. However, my view of how command-line interpreters isn't holding up in this one case:...

Why does sqlite3 command using the android adb shell return "permission denied"?

Specifically, I was trying to use the sqlite3 command with the adb shell to run some queries on the database of the Android application I'm building. I kept getting "sqlite3: permission denied". I'm developing on a Nexus One that I purchased from Google. Does my phone need to be rooted or something? Thanks in advance. $ sqlite3 /da...

Why do I get a "sqlite3: not found" error on a rooted Nexus One when I try to open a database using the adb shell?

# sqlite3 /data/data/com.moodme.android/databases/moodme sqlite3 /data/data/com.moodme.android/databases/moodme sqlite3: not found ...

Windows Explorer, shell extension, a new view type.

Hello, Is it possible to write shell extensions that add a new view type to the view menu in Windows 7? For example, at the moment I have List, Details, Tile, Content, etc. in the drop-down, but I have an idea for a new type. I've done a little Google on shell extensions but the examples I see are more related to custom content within...

How to return only part of a line with egrep

I have a program that returns something like this: status: playing artURL: http://beta.grooveshark.com/static/amazonart/m3510922.jpg estimateDuration: 29400 calculatedDuration: 293000 albumName: This Is It position: 7291.065759637188 artistName: Michael Jackson trackNum: 13 vote: 0 albumID: 3510922 songName: Billie Jean artistID: 39 son...

How can I get information from the shell about commands available in Android shell?

Can't find information on how to print out documentation on android shell commands while in the shell. Something along the lines of help ls ...