Skip to main content

Posts

Showing posts from January, 2013

Why I love linux...

Why ? Sound Juicer exhibited some strange behavior (I'm sure is manageable...) and it added a _ to all the file names... I needed to rename a pile of files to remove the "_".  When doing nonsense such as this, I like to first echo the output out to review, before actually doing the work. [jradtke@cypher Surfing_the_Void]$ for FILE in `ls`; do echo "mv $FILE '`echo $FILE | sed 's/_/ /g'`'"; done mv 10_-_Cypherspeed.mp3 '10 - Cypherspeed.mp3' mv 1_-_Echoes.mp3 '1 - Echoes.mp3' mv 2_-_The_Same_Space.mp3 '2 - The Same Space.mp3' mv 3_-_Surfing_the_Void.mp3 '3 - Surfing the Void.mp3' mv 4_-_Valley_of_the_Calm_Trees.mp3 '4 - Valley of the Calm Trees.mp3' mv 5_-_Venusia.mp3 '5 - Venusia.mp3' mv 6_-_Extra_Astronomical.mp3 '6 - Extra Astronomical.mp3' mv 7_-_Twin_Flames.mp3 '7 - Twin Flames.mp3' mv 8_-_Flashover.mp3 '8 - Flashover.mp3' mv 9_-_Future_Memorie

Old School profile

Now - I believe the preferred methodology is to take advantage of .bashrc and .bash_profile .bashrc is now intended to have alias(es) and functions .bash_profile will have environment and startup programs They appear to be called in this order... .bash_profile   ->  .bashrc     ->  /etc/bashrc          (source /etc/bashrc)     (source ~/.bashrc) (source .bash_profile) So - customizations you add to your own files actually get sourced last.  Specifically the .bash_profile customizations.  Kind of interesting, if you stop to look at the process. # # Copyleft (c) 2003 by Crashwerx Macrosystems, Inc. # All rights reserved. # # ident "@(#).profile      1.10    01/06/23 SMI" # Optimized for ksh # TERMINAL SETTINGS stty istrip #stty erase ^? stty -echoctl ulimit -c 0 umask 022 TERM=vt100 EDITOR=vi VISUAL=vi OS=`uname` hostname=`hostname | cut -f1 -d.` # Make ssh connections (C)ompressed and enable (X)-forward alias SSH="ssh -X -C $1&q

expect foo

I'm not a programmer... but I strive to be lazy... therefore I do what I must to create scripts/commands to save me time.  My current place of work does not allow root logins (as they shouldn't), but I can sudo to run commands, provided that I provide a passwd.  So, I threw this together... A better implementation would be to accept the command as an argument. #!/usr/bin/expect -f # set force_conservative 0  ;# set to 1 to force conservative mode even if  ;# script wasn't run conservatively originally if {$force_conservative} { set send_slow {1 .1} proc send {ignore arg} { sleep .1 exp_send -s -- $arg } } set HOST [lindex $argv 0] set USER [lindex $argv 1] set PASSWD [lindex $argv 2] puts "Arguments: $argc" if { $argc != 3 } {   puts "Usage: ssh_then_sudo.exp <HOSTNAME> <USER> <PASSWORD>"   exit 1 } set timeout -1 spawn $env(SHELL) match_max 100000 puts "Connecting to: ${USER}@${HOST}:${PA