Notes by voodoo

Displaying keyword search results 1 - 10
Created by voodoo on February 16, 2012 14:56:44    Last update: February 16, 2012 15:52:56
Shell functions are declared using this syntax: [ function ] name () compound-command [ redirectio... Example: function ll { ls -alF $* } Example 2: ll() { ls -alF $* } Shell functions can be exported to subshells with the -f switch: $ export -f ll However , I had problems logging in Ubuntu 11.10 after I added this to .profile : export -f ll
Created by voodoo on January 03, 2012 08:41:21    Last update: February 16, 2012 15:50:06
This is the command to print all regular files in the src folder but excluding all files within the .svn folders: $ find src -name .svn -prune -o -type f -print where -o is the or operator. Define a shortcut: ff () { find $1 -name .svn -prune -o -...
Created by voodoo on February 16, 2012 14:57:35    Last update: February 16, 2012 14:57:35
You can use either declare or typeset to list function definitions : To list all function names: declare -F To display a function definition: $ declare -f quote quote () { echo ... If you see a lot of functions with names starting with the underscore ( _ ) and wonder where they come from, they are created by the scripts in /etc/bash_completion.d/ .
Created by voodoo on February 16, 2012 13:35:38    Last update: February 16, 2012 13:35:57
The C shell allows you to define aliases with arguments: \!^ passes the first argument, \!* passes all arguments. Examples from http://unixhelp.ed.ac.uk : alias print 'lpr \!^ -Pps5' alias print 'lp... In ksh or bash you cannot define alias with arguments. Use function instead.
Created by voodoo on November 22, 2011 12:27:12    Last update: November 22, 2011 12:31:50
Unix hidden files are named starting with a dot ".". To find hidden files in the current directory: $ find . -type f -name '.*' or $ find . -type f | grep \\/\\. To find hidden files in the marketing directory: $ find marketing -type f -name '.*' or $ find marketing -type f | grep \\/\\.
Created by voodoo on August 27, 2011 19:17:10    Last update: August 27, 2011 19:17:10
The CPAN module Net::Socket::NonBlock has a port forwarding utility which works for both Unix and Windows: $ perl tcpudppf.pl Usage: tcpudppf.pl <LocalAdd...
Created by voodoo on June 21, 2011 08:19:33    Last update: June 21, 2011 08:34:28
Got "base64: invalid input" error: $ base64 -d base64_encoded.txt >original.bin ba... which can be easily dismissed as "input is invalid base64 encoded" or "partial input". But I know it's valid base64 encoded input! The problem was, the input was base64 encoded on Windows! The error goes away after converting to Unix format with dos2unix . dos2unix < base64_encoded.txt | base64 -d >origina... Version of base64 used: $ base64 --version base64 (GNU coreutils) 8.5 ...
Created by voodoo on June 21, 2011 08:32:15    Last update: June 21, 2011 08:32:15
The Dos2unix package includes utilities "dos2unix" and "unix2dos" to convert plain text files in DOS or MAC format to UNIX format and vice versa. By default, it replaces the original file: $ dos2unix base64_encoded.txt dos2unix: conver... Use the -n switch to write the converted output to a new file: $ dos2unix -n base64_encoded.txt unix_formatted.tx... Using STDOUT ( - ) as output file does not work : $ dos2unix -n base64_encoded.txt - Use input redirection to write to STDOUT: $ dos2unix < base64_encoded.txt
Created by voodoo on November 22, 2010 19:47:18    Last update: November 22, 2010 19:47:43
Use the File::Spec module for portable file path separator (e.g., '/' for Unix/Linux, '\' for Windows): # returns 'a/b/c' on Unix; 'a\b\c' on Windows ... Or # returns 'a/b/c' on Unix; 'a\b\c' on Windows ...
Created by voodoo on July 01, 2010 18:54:08    Last update: August 31, 2010 22:40:41
Problem: cannot connect to PostgreSQL server because of above error. Solution: add the host entries to the /usr/local/pgsql/data/pg_hba.conf file: # TYPE DATABASE USER CIDR-ADDRESS ... Reference for CIDR address: http://oav.net/mirrors/cidr.html
Previous  1 2 Next