Skip to content

Instantly share code, notes, and snippets.

find '/pillar/Lab/' -mindepth 1 -maxdepth 1 -type d |
while read file
do
alias ${file##*/}="'cd $file'"
done
目的:
如果存在 /pillar/Lab/hi 目录,则
alias hi='cd /pillar/Lab/hi'
find '/pillar/Lab/' -mindepth 1 -maxdepth 1 -type d |
while read file
do
eval "alias ${file##*/}='cd $file'"
done
if there is a directory named /pillar/Lab/hi
I want this script exec alias hi='cd /pillar/Lab/hi'
for d in /pillar/Lab/*; do
if [ -d $d ];then
alias ${d##*/}="cd '$d'";
fi
done
$.fn.ajaxLink = function() {
$(this).click(function(){
$.ajax({
url: $(this).attr('href'),
dataType: 'script',
});
return false;
});
};
# Begin /etc/nsswitch.conf
passwd: files
group: files
shadow: files
publickey: files
hosts: files dns
networks: files
require 'rubygems'
require 'sinatra'
require 'rack/contrib'
use Rack::Callbacks
def before
content_type 'text/plain',:charset => 'utf-8'
end
require 'rubygems'
require 'sinatra'
require 'rack/contrib'
class MyApp < Sinatra::Default
get '/' do
'main app!'
end
end
!! Unexpected error while processing request: wrong number of arguments (1 for 0)
wrong number of arguments (1 for 0)
/usr/lib/ruby/gems/1.8/gems/rack-0.9.1/lib/rack/builder.rb:38:in `initialize'
/usr/lib/ruby/gems/1.8/gems/rack-0.9.1/lib/rack/builder.rb:38:in `new'
/usr/lib/ruby/gems/1.8/gems/rack-0.9.1/lib/rack/builder.rb:38:in `use'
/usr/lib/ruby/gems/1.8/gems/thin-1.0.0/lib/thin/connection.rb:63:in `call'
/usr/lib/ruby/gems/1.8/gems/thin-1.0.0/lib/thin/connection.rb:63:in `pre_process'
/usr/lib/ruby/gems/1.8/gems/thin-1.0.0/lib/thin/connection.rb:54:in `process'
/usr/lib/ruby/gems/1.8/gems/thin-1.0.0/lib/thin/connection.rb:39:in `receive_data'
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.6/lib/eventmachine.rb:240:in `run_machine'
-module('area').
-export([start/0,area/2]).
start() -> spawn(fun loop/0).
area(Pid,What) -> rpc(Pid,What).
rpc(Pid,Request) ->
Pid ! {self(),Request},
receive
#!/usr/bin/ruby
# vim: fileencoding=utf-8
require 'rubygems'
require 'zipruby'
require 'openssl'
require 'digest/sha1'
require 'optparse'
require 'fileutils'
require 'find'