Hi all,
I rather cleverly (or not in hindsight) installed RVM, which kept hanging whilst compiling Rubies.
I have removed the .rvm directory but now my system has reverted to Ruby 1.8.7 i.e. when I type:
ruby -v
which ruby
they both point to 1.8.7.
How do I get the ruby command to point to my 1.9.1 installation, which is located in...
Is there a standard bash tool that acts like echo but outputs to stderr rather than stdout?
I know I can do echo foo 1>&2 but it's kinda ugly and, I suspect, error prone (e.g. more likely to get edited wrong when things change).
...
I would like to automate the following svn command. Note this command produces the desired results on my system - Ubuntu 10.04, svn 1.6.6, bash shell, when issued from the command line:
svn ci -m $'Added new File: newFile.txt\nOrig loc: /etc/networking/newFile.txt' /home/user/svnDir/newFile.txt
I would like to run that command in a ba...
Hi I would like to wrap the following comma separated data:
-X, run, abs, absolute, accept, accept, alarm, schedule, atan2, arctangent, bind, binds, binmode, prepare, bless, create, caller, get, chdir, change, chmod, changes, chomp, remove, chop, remove, chown, change, chr, get, chroot, make, close, close, closedir, close, connect, conn...
The general idea is pretty simple, I want to make a script for a certain task, I do it in the shell (any shell), and then I want to copy the commands I have used.
If I copy all the stuff in the window, then I have a lot of stuff to delete and to correct. (and is not easy to copy from shell)
Resume: I want to take all the things I wrote...
How can I log out of my computer using shell such the log-in window appears again?
I need this functionality in one my Linux script.
Update:
I want to replicate the code working behind the Logout button of my Ubuntu.
Desktop Enviroment being used: GNOME
...
I currently commit files to my SVN server (which is located on my web host), and from there I SSH in and export them to the working directory in my htdocs.
As my application gets larger and larger, a full export is a waste of time. How can I only export the files that have been changed?
svn export -r xxxx:HEAD http://svn/
Is a solut...
Hello,
I am trying to make a simple shell script to ping a source but I am getting
bash-2.03$ ./test.sh google.com 10 .5 /home/users/me 16 256
./test.sh: line 35: syntax error near unexpected token `(('
./test.sh: line 35: `for (( i = 1 ; i <= $totalArguments ; i++ ))'
This is the code:
#!/bin/bash
ip=$1
count=$2
interval=$3
outputD...
#include <iostream>
using namespace std;
int main() {
short int enterVal;
cout << "enter a number to say: " << endl;
cin >> enterVal;
system("say "%d"") << enterVal;
return 0;
}
Is what I am currently trying. I want the user to enter a number and the system() function says it basically. The code above has an erro...
I'm writing a tiny script that calls the "PNGOUT" util on a few hundred PNG files. I simply did this:
find $BASEDIR -iname "*png" -exec pngout {} \;
And then I looked at my CPU monitor and noticed only one of the core was used, which is quite sad.
In this day and age of dual, quad, octo and hexa (?) cores desktop, how do I simply pa...
I am trying to write a .sh file that runs many programs simultaneously
I tried this
prog1
prog2
But that runs prog1 then waits until prog1 ends and then starts prog2...
So how can I run them in parallel?
Thanks
...
I have many html files in nested directories which I need to convert to Haml templates
I've modified the following bash script from here - http://terrbear.org/?p=277 to modify html files and not erb but I still need to modify it to be recursive ...
#!/bin/bash
if [ -z "$1" ]; then
wdir="."
else
wdir=$1
fi
for f in $( ls $wdir/*...
In bash, I want to get the Nth word of a string.
For instance:
STRING="one two three four"
N=3
Result: "three"
What bash command/script could do this?
Thank you!
...
I have a file generated from windows that I have to paste into a script under linux.
My script works fine, except for the fact that at the end of every line I got a ^M char.
How can I remove it with bash?
Currently my script is:
#/bin/bash
IFS=$'\n'
for CUSTOMER in `cat exp.csv`
do
echo $CUSTOMER
done
...
I need to recursively remove unnecessary files from a svn repository and i have the following batch file to do this:
@echo on
del /s ~*.*
del /s *.~*
del /s Thumbs.db
However, this is also deleting the entries under the .svn/ subfolders. Is there any way to prevent this commands from being executed under the .svn/ folders so that it d...
Sometimes I edit a file that represents a server restart. I would like to "bind" this restart to my vim session, so, after saving a file, it would call a bash script that would restart for me.
For example, calling :wapache automatically calls restart_apache.sh somewhere in my machine.
Is this possible? Is there a plugin that would orga...
Hello All,
It seems to me that they both store all the command-line argument.
So is there a difference between this two ?
Thanks
...
I'm trying to remove a case clause from a bash script. The clause will vary, but will always have backslashes as part of the case-match string.
I was trying sed but could use awk or a perl one-liner within the bash script.
The target of the edit is straightforward, resembles:
$cat t.sh
case N in
a\.b);
#[..etc., varies]
;;
...
I have a bunch of music files on a NTFS partition mounted on linux that have filenames with unicode characters. I'm having trouble writing a script to rename the files so that all of the file names use only ASCII characters. I think that using the iconv command should work, but I'm having trouble escaping the characters for the 'mv' com...
I have written a small bash script called "isinFile.sh" for checking if the first term given to the script can be found in the file "file.txt":
#!/bin/bash
FILE="file.txt"
if [ `grep -w "$1" $FILE` ]; then
echo "true"
else
echo "false"
fi
However, running the script like
> ./isinFile.sh -x
breaks the script, since -x is inter...