You are not logged in.

#1226 2010-08-10 09:17:48

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,838

Re: Post your handy self made command line utilities

fukawi2 wrote:

It's dirty, but useful for quick encryption/decryption of individual files (like the text file with the credit card numbers tongue)

Here's my version

pw ()
{ 
    gpg -d $HOME/pathtofile/passwords.exp.asc | gawk 'BEGIN    { FS = ""; RS = ""; IGNORECASE = 1}; 
                                                     /'"$@"'/ {print $0}'
}

Last edited by skanky (2010-08-10 09:18:54)


"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Offline

#1227 2010-08-10 11:44:09

Ogion
Member
From: Germany
Registered: 2007-12-11
Posts: 367

Re: Post your handy self made command line utilities

I just have this vim-plugin.
Then i simply encrypt a file with gpg, and hence on i can do "vim file.gpg" and vim handles decryption and encryption when i save and quit.

Ogion


(my-dotfiles)
"People willing to trade their freedom for temporary security deserve neither and will lose both." - Benjamin Franklin
"Enlightenment is man's leaving his self-caused immaturity." - Immanuel Kant

Offline

#1228 2010-08-10 19:27:09

tony5429
Member
Registered: 2006-03-28
Posts: 909
Website

Re: Post your handy self made command line utilities

I run this on a web server as a per-minute cron job to randomly execute a PHP script in the /home/rt_cron directory - note that the if clause makes sure there are never two scrips running simultaneously (sexy, I know!).

if [ $(ps aux | grep /home/rt_cron | grep -v grep | wc -l) -eq 0 ] ; then
    rm -r /home/rt_temp/*;
    scripts=(`ls /home/rt_cron/*.php`);
    php -f ${scripts[$((RANDOM%${#scripts[*]}))]};
fi

Yellowcot: A free, lightweight, open-source, cross-platform, Qt-based multimedia flash card simulator.

Offline

#1229 2010-08-10 22:18:39

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,092
Website

Re: Post your handy self made command line utilities

tony5429 wrote:

I run this on a web server as a per-minute cron job to randomly execute a PHP script in the /home/rt_cron directory - note that the if clause makes sure there are never two scrips running simultaneously (sexy, I know!).

if [ $(ps aux | grep /home/rt_cron | grep -v grep | wc -l) -eq 0 ] ; then
    rm -r /home/rt_temp/*;
    scripts=(`ls /home/rt_cron/*.php`);
    php -f ${scripts[$((RANDOM%${#scripts[*]}))]};
fi

Except that...

1) Your test to find if the script is already running is prone to failure in a variety of ways, and your test is overly complex. grep will return true when it finds a result, so there's no need to wrap the whole thing in [[ ]] and pipe to wc just to count the lines. etc etc etc.. use a lockfile.

2) You're trying to parse the output of ls. Shorten it up:

scripts=(/home/rt_cron/*.php)

Offline

#1230 2010-08-13 08:17:48

Ari'osika
Member
From: Your computer, okay?
Registered: 2010-06-22
Posts: 175

Re: Post your handy self made command line utilities

#! /usr/bin/perl
foreach my $key (keys %ENV) {
    print "-----\n$key \n $ENV{$key}\n";
}
print "-----";

A quick hack I use to display my environmental variables whenever I need to see them. Yes, I know there's probably a command for it but for some reason I can never remember it 0.o


If you're reading this; you're awesome.

Offline

#1231 2010-08-13 09:04:01

dmz
Member
Registered: 2008-08-27
Posts: 866
Website

Re: Post your handy self made command line utilities

Ari'osika wrote:
#! /usr/bin/perl
foreach my $key (keys %ENV) {
    print "-----\n$key \n $ENV{$key}\n";
}
print "-----";

A quick hack I use to display my environmental variables whenever I need to see them. Yes, I know there's probably a command for it but for some reason I can never remember it 0.o

perl -E 'say for%ENV'
env

Offline

#1232 2010-08-13 10:33:45

Ari'osika
Member
From: Your computer, okay?
Registered: 2010-06-22
Posts: 175

Re: Post your handy self made command line utilities

dmz wrote:
perl -E 'say for%ENV'
env

Know the first one (and use it) but can never remember the second one for some reason; I think perl programming has greatly retarded my CLI skills big_smile

Thanks anyways.


If you're reading this; you're awesome.

Offline

#1233 2010-08-15 21:03:28

cubeist
Member
Registered: 2010-08-01
Posts: 36

Re: Post your handy self made command line utilities

tony5429 wrote:

I run this on a web server as a per-minute cron job to randomly execute a PHP script in the /home/rt_cron directory - note that the if clause makes sure there are never two scrips running simultaneously (sexy, I know!).

if [ $(ps aux | grep /home/rt_cron | grep -v grep | wc -l) -eq 0 ] ; then
    rm -r /home/rt_temp/*;
    scripts=(`ls /home/rt_cron/*.php`);
    php -f ${scripts[$((RANDOM%${#scripts[*]}))]};
fi

I'm not sure what you have in your rt_temp folder, and it may not matter in this instance, but in general, using a predictable file name for temp files/folders on a web server is a know security concern.

I use the fantastic program mktmp in all my scripts to create temporary files and folders.  Its super easy to use (man mktmp).

Offline

#1234 2010-08-18 08:44:00

Doctor Drive
Member
From: Ukraine
Registered: 2010-08-11
Posts: 165
Website

Re: Post your handy self made command line utilities

it's an audio converter that converts to m4a aac files.
I've got all my music stored as an albums stored in a folder and tracks are named like this

01 A Wise Birthgiver.mp3
02 Wall Of Water.mp3
03 Great Work Of Ages.mp3
04 Deconsecrate.mp3
06 Psychic Horns.mp3
07 Key To The Storms.mp3
08 Anti.mp3

So, i copy the script into this folder, set up the output bitrate I need, and number of tracks i want to convert, and launch.

Requirements:
neroaacenc
ffmpeg
#!/bin/bash

for i in {1..8}
do
    if [ $i -lt 10 ]; then ffmpeg -i 0$i* -acodec pcm_s16le 0$i.wav
    else ffmpeg -i $i* -acodec pcm_s16le $i.wav
    fi

    if [ $i -lt 10 ]; then neroaacenc -if 0$i.wav -br 128000 -of 0$i.m4a
    else neroaacenc -if $i.wav -br 128000 -of $i.m4a
    fi

    if [ $i -lt 10 ]; then rm 0$i.wav
    else rm $i.wav
    fi
done

and the output files are

01.m4a
02.m4a
03.m4a
...

Offline

#1235 2010-08-18 09:17:19

archman-cro
Member
From: Croatia
Registered: 2010-04-04
Posts: 943
Website

Re: Post your handy self made command line utilities

My simple hibernation script called 'sleeper'. When I wanna go sleep and leave the music running for some time, this hibernates after some time has passed.

#!/bin/bash

echo -n "Go into hibernation in [minutes]: "
read MINS
let "SECS = $MINS * 60"
echo "Going into hibernation in $MINS mins ($SECS secs)..."
sleep $SECS && ncmpcpp stop && echo 'password' | sudo -S hibernate -F /etc/hibernate/tuxonice.conf

I've just realized that I should implement an mpd stop feature, also, so I did it on the fly now. big_smile

Offline

#1236 2010-08-18 10:02:18

GraveyardPC
Member
Registered: 2008-11-29
Posts: 99

Re: Post your handy self made command line utilities

I use something similar in my bashrc:

sleeptimer(){
    local min=${1:-"90"} name=${2:-"mplayer"}
    echo "DISPLAY="$DISPLAY" xset dpms force off && pkill "$name | \
    at now + $min minutes 2>/dev/null
}

Offline

#1237 2010-08-18 10:02:54

k3ttc4r
Member
From: around somewhere
Registered: 2008-12-28
Posts: 137
Website

Re: Post your handy self made command line utilities

wgetM - a simple download "manager" for wget

Well, of course it's not a real download "manager". It just downloads files and sorts them according to the file extension. I wrote it to be used with Firefox's "FlashGot" extension (I call it with "urxvt --geometry 80x1 -e bin/wgetm [ url ]", gives me a nice one-line urxvt showing just the progressbar), but it works just as well as stand-alone.

It's really simple and easily extensible. Doesn't support a lot of file types yet, I just finished writing it, and I'll add some more along the way.

Usage: wgetm FILES

#!/bin/bash

#===================================================
#
#       wgetM
#
#===================================================
#   A simple download "manager" for wget
#---------------------------------------------------

# Config ===========================================

BASEDIR='/home/christian/Downloads/Firefox/'

TMPDIR='temp/'

ARCHIVEDIR='Archive/'
MUSICDIR='Musik/'
PICTUREDIR='Bilder/'
TORRENTDIR='Torrents/'
VIDEODIR='Videos/'
OTHERDIR='Andere/'

# Config End =======================================

# Download Files
cd $BASEDIR$TMPDIR
wget $@

# Sort Files
for f in *
    do
        case $f in
            # Archives
            *.7z | *.7z.* | *.ar | *.jar | *.part* | *.rar | *.rar.* | *.tar | *.tar.* | *.zip )
                mv $f $BASEDIR$ARCHIVEDIR ;;
            # Music
            *.ape | *.flac | *.mp3 | *.mp4 | *.m4a | *.m4r | *.oga | *.ogg | *.wma | *.wav )
                mv $f $BASEDIR$MUSICDIR ;;
            # Pictures
            *.arw | *.bmp | *.gif | *.jpeg | *.jpg | *.png | *.raw | *.svg | *.tif | *.tiff )
                mv $f $BASEDIR$PICTUREDIR ;;
            # Torrents
            *.torrent )
                mv $f $BASEDIR$TORRENTDIR ;;
            # Videos
            *.avi | *.flv | *.m4v | *.mkv | *.mpeg | *.mpg | *.ogv | *.wmv )
                mv $f $BASEDIR$VIDEODIR ;;
            # Others
            * )
                mv $f $BASEDIR$OTHERDIR ;;
        esac
    done

Last edited by k3ttc4r (2010-08-18 10:04:14)


arch64   ||   github | dotshare | blog

Offline

#1238 2010-08-19 00:19:00

splittercode
Member
From: WI, USA
Registered: 2010-03-16
Posts: 203

Re: Post your handy self made command line utilities

I don't know if this qualifies as a command line utility, but here is a simple script to help dmenu launch terminal applications.

#!/bin/bash

term="urxvtc"
nf="#efefef"
nb="#2c2c2c"
sb="#2c2c2c"
sf="salmon"
font="-*-proggycleanszcp-*-*-*-*-*-*-*-*-*-*-*-*"

apps=$(cat ~/.dmenu_cache)

cmd=$(dmenu -nb $nb -nf $nf -sb $sb -sf $sf -fn $font <<< "$apps")

case ${cmd%% *} in
     ncmpcpp)     exec $term -e ncmpcpp;;
     mutt)        exec $term -e mutt;;
     vim)         exec $term -e vim;;
     ranger)      exec $term -e ranger;;
     *)           exec $cmd
esac

If you add an application to the list at the bottom, dmenu launches it in the specified terminal, otherwise it launches it normally.  (Something like this might exist already, but I couldn't find it anywhere.)

Last edited by splittercode (2010-08-19 01:22:24)

Offline

#1239 2010-08-19 06:34:23

Hiram
Member
From: Brisbane, Australia
Registered: 2010-02-13
Posts: 67
Website

Re: Post your handy self made command line utilities

I remember seeing this somewhere on here before, in fact it's probably in this thread, but I find this very useful:

service() {
   sudo /etc/rc.d/$@
}

I save it as a bash script, and zsh picks up the possible daemons and their options with its magical autocomplete. Much easer for me than typing out the full path.

Offline

#1240 2010-08-20 06:50:58

burninating__absol
Member
Registered: 2010-03-07
Posts: 45

Re: Post your handy self made command line utilities

This is a project I made before I knew about FlexGet. I think I'll keep working on it though, at the very least clean it up.
podcastr:

#!/usr/bin/env python

import feedparser, os, errno, urllib 

def mkdir(path):
  try:
    os.makedirs(path)
  except OSError as exc: 
    if exc.errno == errno.EEXIST:
      pass
    else:
      raise

# Config
podcastfolder = '/mnt/Music_1'
podcasts = {'SYSK':'http://www.howstuffworks.com/podcasts/stuff-you-should-know.rss',
'STDWYTK':'http://www.howstuffworks.com/podcasts/stuff-they-dont-want-you-to-know.rss', 
'LINUXOUTLAWS':'http://feeds.feedburner.com/linuxoutlaws'}
# /Config

# 256-colored output via trapd00r/dmz's xcolors
i = 202

for key, value in podcasts.items():

  mkdir(podcastfolder + "/" + key)
  podcast = feedparser.parse(value)
  url = podcast['entries'][0]['enclosures'][0]['href']
  filename = url.split('/')[-1] # get last part of list, the file name
  fullpath = podcastfolder + "/" + key + "/" + filename

  if os.path.isfile(fullpath) == False:
    print "\033[38;5;%imDownloading: %s > %s/%s" % (i,filename,podcastfolder,key)
    urllib.urlretrieve(url, fullpath)
  elif os.path.isfile(fullpath) == True:
    print "\033[38;5;%im%s is up to date." % (i,podcast['feed']['title'])
  i += 1
# NAME

podcastr - A Python podcast updater

# SYNOPSIS 
  
podcastr does not use arguments in this release.

# NOTICES

+ Podcastr does not include a configuration file or support multiple file
  downloads within a podcast in this release.

+ The file podcastr must be edited with the appropriate information in this
  release.

# REQUIREMENTS 
    
python 2.5+ (Arch Official Repositories: `python`)

urllib module for python (Arch User Repository: `python-urljr`)

feedparser module for python (Arch Official Repositories: `python-feedparser`)

currentproblem: none.

Offline

#1241 2010-08-20 17:31:48

TaylanUB
Member
Registered: 2009-09-16
Posts: 150

Re: Post your handy self made command line utilities

archman-cro wrote:

My simple hibernation script called 'sleeper'. When I wanna go sleep and leave the music running for some time, this hibernates after some time has passed.

#!/bin/bash

echo -n "Go into hibernation in [minutes]: "
read MINS
let "SECS = $MINS * 60"
echo "Going into hibernation in $MINS mins ($SECS secs)..."
sleep $SECS && ncmpcpp stop && echo 'password' | sudo -S hibernate -F /etc/hibernate/tuxonice.conf

I've just realized that I should implement an mpd stop feature, also, so I did it on the fly now. big_smile

GNU's sleep(1) (coreutils) supports time expressions with prefixes like m for minute, h for hour, etc..
You can just let the user specify a string like that, and pass it directly to sleep(1).

#!/bin/dash

echo 'suffix s (or nothing) for seconds, m for minutes, h for hours, d for days; expressions can be catenated'
echo -n 'Hibernate in: '
read time
sleep "$time" && ncmpcpp stop && echo 'password' | sudo -S hibernate -F /etc/hibernate/tuxonice.conf

I was halfway into implementing checking against wrong input and auto-detecting the unit for some nice output, but then remembered that catenated expressions like "1h 20m 30s" are also supported, and that's hard as hell to parse.


``Common sense is nothing more than a deposit of prejudices laid down by the mind before you reach eighteen.''
~ Albert Einstein

Offline

#1242 2010-08-21 17:41:27

mulenmar
Member
Registered: 2009-06-18
Posts: 34
Website

Re: Post your handy self made command line utilities

A handy shell script to set the backlight brightness on a netbook using the Poulsbo chipset and PSB driver.

#! /bin/sh
sudo sh -c "echo $1 > /sys/class/backlight/psblvds/brightness"

Simply save it as brightness.sh, and give it executable permissions. Then you can use it like so:

Set brightness to minimum:

./brightness.sh 0

Set brightness to half:

./brightness.sh 50

Sudo may obviously ask for your password, so you have to be in the sudoers file. cool

I've tested this with both Bash and Dash.

This "code" is released under the GPL v3 license. http://www.gnu.org/licenses/gpl.html

Last edited by mulenmar (2010-08-21 18:01:23)

Offline

#1243 2010-08-21 18:53:13

gazj
Member
From: /home/gazj -> /uk/cambs
Registered: 2007-02-09
Posts: 679
Website

Re: Post your handy self made command line utilities

Hiram wrote:

I remember seeing this somewhere on here before, in fact it's probably in this thread, but I find this very useful:

service() {
   sudo /etc/rc.d/$@
}

I save it as a bash script, and zsh picks up the possible daemons and their options with its magical autocomplete. Much easer for me than typing out the full path.

I use this, it should work on distros that use init.d rather than rc.d also.  (well I know it works on gentoo and arch)

# daemon controls

if [ -d /etc/rc.d ]; then 
    SERLOC="rc.d"
else
    SERLOC="init.d"
fi

start()
{
for arg in $*; do
sudo /etc/$SERLOC/$arg start
done
}

restart()
{
for arg in $*; do
sudo /etc/$SERLOC/$arg restart
done
}

stop()
{
for arg in $*; do
sudo /etc/$SERLOC/$arg stop
done
}

Last edited by gazj (2010-08-21 18:56:59)

Offline

#1244 2010-08-22 19:22:35

markp1989
Member
Registered: 2008-10-05
Posts: 431

Re: Post your handy self made command line utilities

just wrote this to try out the "read" command, it lists the current running screen sessions, then asks you to select the number, then resumes the one you sellect, right now i have to count the lines and then type which line its on, i dont know how to get bash or grep to number lines yet.

#!/bin/bash
##output available screen sessions 
 screen -ls | egrep "(Detached)" | cut -f2 -d'.'| cut -f1 -d'(' | nl

##ask user which screen they want to use
echo -e "can you type the number you want to resume: \c "
read  number 

screen -r $(screen -ls | egrep "(Detached)" | head -n $n

example output:

mark@torrentslave:~$ ./screenresume.sh 
  1      esniper-blackberry   
  2      esniper-cpu     
can you type the number you want to resume: 

so typing 1 would resume the esniper-blackberry , and 2 would resume esniper cpu.

i find this pretty usefull, as its not uncommon for me to have 5 of more screen sessions running at a time.

Last edited by markp1989 (2010-08-22 21:09:04)


Desktop: E8400@4ghz - DFI Lanparty JR P45-T2RS - 4gb ddr2 800 - 30gb OCZ Vertex - Geforce 8800 GTS - 2*19" LCD
Server/Media Zotac GeForce 9300-ITX I-E - E5200 - 4gb Ram - 2* ecogreen F2 1.5tb - 1* wd green 500gb - PicoPSU 150xt - rtorrent - xbmc - ipazzport remote - 42" LCD

Offline

#1245 2010-08-22 20:41:23

Stebalien
Member
Registered: 2010-04-27
Posts: 1,218
Website

Re: Post your handy self made command line utilities

markp1989 wrote:

just wrote this to try out the "read" command, it lists the current running screen sessions, then asks you to select the number, then resumes the one you sellect, right now i have to count the lines and then type which line its on, i dont know how to get bash or grep to number lines yet.

Pipe the output through nl to number the lines.

Last edited by Stebalien (2010-08-22 21:08:45)


Steven [ web : git ]
GPG:  327B 20CE 21EA 68CF A7748675 7C92 3221 5899 410C
Do not email: honeypot@stebalien.com

Offline

#1246 2010-08-22 21:05:37

markp1989
Member
Registered: 2008-10-05
Posts: 431

Re: Post your handy self made command line utilities

Stebalien wrote:
karmp1989 wrote:

just wrote this to try out the "read" command, it lists the current running screen sessions, then asks you to select the number, then resumes the one you sellect, right now i have to count the lines and then type which line its on, i dont know how to get bash or grep to number lines yet.

Pipe the output through nl to number the lines.

thanks, that done exactly what i wanted., just gone edit my post to include the change smile

anyone else notice that my username got jumbled up in the quote?


Desktop: E8400@4ghz - DFI Lanparty JR P45-T2RS - 4gb ddr2 800 - 30gb OCZ Vertex - Geforce 8800 GTS - 2*19" LCD
Server/Media Zotac GeForce 9300-ITX I-E - E5200 - 4gb Ram - 2* ecogreen F2 1.5tb - 1* wd green 500gb - PicoPSU 150xt - rtorrent - xbmc - ipazzport remote - 42" LCD

Offline

#1247 2010-08-22 21:08:25

Stebalien
Member
Registered: 2010-04-27
Posts: 1,218
Website

Re: Post your handy self made command line utilities

markp1989 wrote:

Anyone else notice that my username got jumbled up in the quote?

Sorry, my bad.


Steven [ web : git ]
GPG:  327B 20CE 21EA 68CF A7748675 7C92 3221 5899 410C
Do not email: honeypot@stebalien.com

Offline

#1248 2010-08-23 04:17:36

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,092
Website

Re: Post your handy self made command line utilities

Convert CSV files to HTML tables. Catenate multiple files from the command line into a single output or read from STDIN.

It was pure Bash until I realized that blank fields were causing issues, and had to throw in the sed call (which could probably be written with PEs).

#!/bin/bash

NUMFIELDS=0
OUT=()

to_html() {
  local LC=0 # line counter in case of error

  while IFS=',' read -r -a items; do
    (( ++LC ))
    OUT+=("\t<tr>\n") # start row

    # skip blank lines, but not lines with empty fields
    (( ${#items[@]} == 0 )) && continue

    # assert: all rows are same number of columns
    (( NUMFIELDS == 0 )) && NUMFIELDS=${#items[@]}
    if (( NUMFIELDS != ${#items[@]} )); then
      echo "error: Malformed CSV ($file: line $LC). Expected $NUMFIELDS fields, found ${#items[@]}." >&2
      exit 1
    fi

    # output each column, stripping NULL tokens
    for item in "${items[@]}"; do
      OUT+=("\t\t<td>${item/==NULL==/}</td>\n")
    done

    OUT+=("\t</tr>\n") # end row

  # replace blank fields with a dummy value so read doesn't skip them
  done < <(sed 's/^,/==NULL==,/;
                s/,,/,==NULL==,/g;
                s/,$/,==NULL==/' <&6)
}

OUT+=("<table>\n") # header

# use a new FD to unify where to read from
if (( $# == 0 )); then
  exec 6<&0
  to_html
else
  for file; do
    exec 6< "$file"
    to_html
    exec 6<&-
  done
fi

OUT+=("</table>\n") # footer

echo -e "${OUT[@]}"

Offline

#1249 2010-08-23 19:21:14

dmz
Member
Registered: 2008-08-27
Posts: 866
Website

Re: Post your handy self made command line utilities

If you dont know what to put in that latest commit msg...

#!/usr/bin/perl
# wtc - get random retarded commit msgs
use strict;
use LWP::Simple;

for(get('http://whatthecommit.com/')) {
  if(m;<p>(.+)\n</p>;) {
    print $1,"\n";
  }
}

punpack - extract a show, play it, delete the unpacked file and keep track of
what shows I've seen.

#!/usr/bin/perl
# chmod, unpack, watch, delete
use strict;
use Cwd;
use File::Find;

my $mp = 'mplayer -msgcolor';
my $pwd = shift // getcwd();

my $permdir  = 01742; # -rwxr---wT

chmod($permdir, $pwd);

my $tempdir;
$pwd =~ m/^((?:\/[^\/]+){2}\/).*/ and $tempdir = "$1.punpack-temp";

$tempdir = '/tmp/' if(@ARGV);

use vars qw/*name *dir *prune/;
*name   = *File::Find::name;
*dir    = *File::Find::dir;
*prune  = *File::Find::prune;

File::Find::find({wanted  => \&wanted}, $pwd);

sub wanted {
  /^.+(?:part00)?\.rar/
  && doexec(0, "rar x \"{}\" $tempdir/ && $mp $tempdir/* && rm -rv $tempdir/");
}

sub doexec ($@) {
    my $ok = shift;
    my @command = @_; # copy so we don't try to s/// aliases to constants
    for my $word (@command) {
      $word =~ s#{}#$name#g;
    }
    if ($ok) {
        my $old = select(STDOUT);
        $| = 1;
        print "@command";
        select($old);
        return 0 unless <STDIN> =~ /^y/;
    }
    chdir($pwd); #sigh
    system(@command);
    chdir $File::Find::dir;
    return !$?;
}

Last edited by dmz (2010-08-23 19:25:56)

Offline

#1250 2010-08-25 04:47:54

Peasantoid
Member
Registered: 2009-04-26
Posts: 928
Website

Re: Post your handy self made command line utilities

Not really a utility, but I've found it very useful.

printf "%${COLUMNS}s\r"

If output after a command, it ensures that non-newline-terminated output does not mess with your prompt. It works by emitting ${COLUMNS} (terminal width) spaces to move to a new line if the current line is not empty, then a carriage return to move to column 0. If you put this in your PS1, remember to surround the command with \[...\] so the shell doesn't miscalculate the line length. (Protocol for non-bash shells may be different.)

Someone might have said this already, but I didn't bother to check the 50+ pages of this thread.

Now, back to lurking for another few months...

Last edited by Peasantoid (2010-08-25 04:54:59)

Offline

Board footer

Powered by FluxBB