Hi everyone,
I've installed rvm following the official guide on rvm. I installed Ruby 1.8.7 with rvm install 1.8.7 and then set it as default with rvm 1.8.7 --default.
Now I tried to install 1.9.2 with rvm install 1.9.2(also tried rvm install 1.9.2-head). Everything goes fine until I get to the "ruby-1.9.2-head - #installing-part.
The...
I have a find command that I would like to sort such that entries for certain directories are sorted last. The reason is that this list is to be passed to etags to create a tags table and I would like certain third-party tool directories to be after all the code I actively edit.
Can someone suggest a good easy way in to sort the list a...
Hi,
I want to put command option of rsync into a variable so I can reuse it for other rsync commands. Here is what I tried but it didn't work.
roption="-a --recursive --progress --exclude='class' --delete --exclude='exclude' --exclude='.svn' --exclude='.metadata' --exclude='*.class'"
rsync "$roption" /media/CORSAIR/workspace ~/
Can a...
I am trying to set up bash completion for a utility script I wrote, so I added the following script to /etc/bash_completion.d:
_mcd()
{
local cur words
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
words=`mcd-completion-words`
COMPREPLY=( $(compgen -W "${words}" -- "$cur") )
return 0
}
complete -F _mcd mcd
The ...
Hi all,
I have a serial device set up as loopback (meaning it will simply echo back any character it receives), and I'd like to measure effective throughput speed. For this, I hoped I could use time, as in
time bash -c '...'
where '...' would be some command I could run.
Now, the first problem is that I want to use the device at 2...
Hi everyone,
I have a configuration file that has variables and value separate by spaces. I want to take the value (in the second column) of certain matches and inline edit the file, dividing this match by 2. I also would like to preserve spacing and use a ceiling function on the value.
For example, the file:
To recap, using an actu...
Hello,
When I have:
dirty working directory,
dirty staging area,
and I copied some new files to the project,
how do I stage only the new ones?
git alias adduntracked=…
...
I have bash function which run python (which return all finded regex from stdin)
function find-all() {
python -c "import re
import sys
print '\n'.join(re.findall('$1', sys.stdin.read()))"
}
When I use this regex find-all 'href="([^"]*)"' < index.html it should return first group from the regex (value of href attribute from file in...
I would like a command line function that I can run on any file to change the include("myinc.inc"); PHP statement to include 'myfile.inc'; I have made a start by adding the following to my ~/.bashrc file:
function makestandard() {
perl -p -i -e 's/include\("([\w\.]+)"\)/include '$1'/g' $*
}
I source ~/.bashrc; and run the command ...
Hello,
I want to create a simple Console in Tcl/Tk
I have two problems. First changing every * with a [glob *] but also, when my entry contains "ls -a" it doesn't understand that ls is the command and -a the first arg.
How can I manage to do that ?
Thanks
proc execute {} {
# ajoute le contenu de .add_frame.add_entry
set valu...
I have written a bash script, A, that is calling another script, B, over 1000 times in a loop.
Ctrl+C kills only script B, only one iteration. Script A keeps running and calling script B again.
Can I rewrite something in these scripts so that Ctrl+C will kill script A?
...
Hey all,
I created a small shell script which logs all of it's input to a log file, with which I had thought I could replace the sendmail binary and thus achieve a simple way to simulate e-mail delivery without actually setting up a working sendmail.
This failed, however. For reasons I cannot understand.
I've looked at the PHP mail.c ...
Hi,
I would like to convert the current date and time into a hex time stamp, something like:
Tue Feb 2 10:27:46 GMT 2010 converted into 0x6d054a874449e
I would like to do this from a bash script, any idea how I might do that?
Thanks
J
...
Is there a way to put the terminal on the web browser instead, so I just fire up localhost:80 and then I'll have a terminal on it that I can use and whatever I execute it will execute on my local web server?
And the outputs I want to be displayed on the web browser too, just like a normal Terminal.
I'm using Ruby on Mac OS X/Ubuntu.
...
Hi
As it says ... in OSX can i create an application based off a bash script - that accepts arguments ?
So for example i can run in terminal :
open /path/to/MyBashScriptApp.app myArgument1
This app will run with the argument passed to it?
I know i can rename to .command - but i need it to be an app .
...
Hi!
I am trying to use the simple fuinction below. But i get error sayin unary oprator expected and the output is always one. Can any1 help me correct it.
#!/bin/bash
checkit ()
{
if [ $1 = "none" ]
then
echo "none"
else
echo "one"
fi
}
checkit
...
Here is my case:
I want to use a web browser to connect to a Rails application that runs this example code on the server side:
Dir.chdir path_typed_in_by_user
system "ls -la"
I want the output of "ls -la" to be displayed on the web browser.
Is this possible somehow?
...
I want to display all lines from one which match regular expression
if I have a file
foo
bar123
baz12435
lorem
ipsum
dolor
sit
amet
this display-from baz[0-9]* < file sould return (It doesn't matter if it display matched line or not)
lorem
ipsum
dolor
sit
amet
How can I do this in Linux (with sed, awk or grep)
...
I have a script I want to execute with open4.
Here is the file:
script
#!/usr/bin/env ruby
print "Enter your username: "
username = gets
puts "Here is your username: #{username}"
print "Enter your password: "
password = gets
puts "Here is your password: #{password}"
Then I fire up IRB and type:
ruby-1.9.2-p0 > pid, stdin, stdout, s...
Like most makefiles, I have some bash scripts that use variables for executables. For example, $mysql_exec for /usr/bin/mysql. I would like to be able to say something like:
mysql_exec=mysql
to use $PATH or
mysql_exec=/usr/bin/mysql
to get an absolute location without $PATH. I also want to check to see if the executable is valid u...