How stop to going to new line in Shell script
For Ex : echo "adsa " >> a.txt echo "asdad " >> a.txt in my file adsa asdad But i am looking for adsa asdad ...
For Ex : echo "adsa " >> a.txt echo "asdad " >> a.txt in my file adsa asdad But i am looking for adsa asdad ...
So I'm trying to execute a shell script which produces a lot of output(in 100s of MBs) from a Java file. This hangs the process and never completes. However, within the shell script, if I redirect the output of the script to some log file or /dev/null Java file executes and completes in a jiffy. Is it because of amount of data that the...
I'm wondering if there is a better way to make a daemon that waits for something using only sh than: #! /bin/sh trap processUserSig SIGUSR1 processUserSig() { echo "doing stuff" } while true; do sleep 1000 done In particular, I'm wondering if there's any way to get rid of the loop and still have the thing listen for the signals. ...
How can I convert a string containing glob characters such as /var/lib/gems/*/bin into a colon-separated string of filenames (i.e. PATH compatible) matching the pattern? i.e. echo /var/lib/gems/*/bin will return /var/lib/gems/1.8/bin /var/lib/gems/1.9.1/bin I want /var/lib/gems/1.8/bin:/var/lib/gems/1.9.1/bin instead. The obv...
Hi, I want to do sth. like this: foo=(a b c) foo-=b echo $foo # should output "a c" How can I remove an entry from an array? foo-=b does not work. The removal should work no matter where the entry is. ...
The default behavior for the [TAB] key in the shell is to automatically auto-complete or list the files in the current directory. How to override this behavior in the shell for some chosen applications? Edit: This is not related to the application that is being used, rather, it's the shell environment that needs to be customized! (Thank...
Hi all: I know this must be a stupid question, but how could I pipe the result from a which command to cd? This is what I am trying to do: which oracle | cd cd < which oracle But none of them works :( Is there a way to achieve this (rather than copy/paste of course)? Thanks a lot in advance! Edit : on second thought, this command...
DISPLAY_HEADER=1 if [ "$1" != "test" -o "$1" != "test2" ] then if [ $DISPLAY_HEADER == 1 ]; then DISPLAY_HEADER=0 echo "sdasa " echo $1 fi fi its display sdasa and -o is not working ? what is wrong ? ...
Hi I have a file with records that are of the form: SMS-MT-FSM-DEL-REP country: IN 1280363645.979354_PFS_1_1887728354 SMS-MT-FSM-DEL-REP country: IN 1280363645.729309_PFS_1_1084296392 SMS-MO-FSM country: IR 1280105721.484103_PFM_1_1187616097 SMS-MO-FSM country: MO 1280105721.461090_PFM_1_882824215 This lends itself to parsing via a...
In the following, I would like check if a given variable name is set: $ set hello $ echo $1 hello $ echo $hello $ [[ -z \$$1 ]] && echo true || echo false false Since $hello is unset, I would expect the test to return true. What's wrong here? I would assume I am escaping the dollar incorrectly. TYIA ...
HI I am not very good with linux shell scripting.I am trying following shell script to replace revision number token $rev -<rev number> in all html files under specified directory cd /home/myapp/test set repUpRev = "`svnversion`" echo $repUpRev grep -lr -e '\$rev -'.$repUpRev.'\$' *.html | xargs sed -i 's/'\$rev -'.$repUpRev.'\$'/'\...
Hi, I've got something like that: xinput --list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ Microsoft Basic Optical Mouse id=8 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master...
Hey guys and gals, I'm not sure if this is possible in one line (i.e., without writing a script), but I want to run an ls | grep command and then for each result, pipe it to another command. To be specific, I've got a directory full of images and I only want to view certain ones. I can filter the images I'm interested in with ls | gr...
Trying to find a way to execute a function within BASH after changing into a directory. for example, # cd code/project/blah "Your latest modified files are main.cc blah.hpp blah.cc" (~/code/project/blah) # _ With the above I'm hoping to be able to wrap other functionality around the bash command. Was hoping to find something along t...
The following works fine from command line /usr/bin/mysqldump -uUser -pPass Db_name > /var/www/db_backup/db.`date +%Y%m%d%H%M`.sql but when I try to do that in cron, I get the error: bad ` sign errors in crontab file, can't install I saw someone else on the net solve the same problem by escaping the percent signs, but that didn't...
I am trying to learn shell scripting and I am kind of confused with the idea of := or default value #!/bin/sh echo "Please enter a number \c" read input input=$((input % 2)) if [ $input -eq 0 ] then echo "Th...
What's the easiest way to sort a comma separated list of values in Mac OS X: Input: "a, b, aaa, bc" Output: "a, aaa, b, bc" I'd like to do this from the terminal so that I can pipe the output to another command. ...
I hardly ever use the function keys on my macbook pro. I mostly just use them for volume, brightness, etc. Now that I've started playing Starcraft 2 a bunch, I want to use them without having to press the fn key down. I want to write a little shell script that will flip the "Use all F1, F2, etc keys as standard function keys" check box...
I'm using git with trac. After push I want two thing to be done: Sending email to development team with diff If there is some special phrase in commit message (like "see #1"), then I want the commit message to be placed in trac ticket. The first thing is solved by git-commit-notifier. It works perfectly after I have created post-rece...
I am using a interactive command line program in a Linux terminal running the bash shell. I have a definite sequence of command that I input to the shell program. The program writes its output to standard output. One of these commands is a 'save' command, that writes the output of the previous command that was run, to a file to disk. A...