LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices

Old

A good $PS1 for displaying long paths in the bash prompt

Posted 03-13-2013 at 11:29 PM by the dsc (linux-related notes)
Updated 03-13-2013 at 11:30 PM by the dsc
Tags bash, prompt, ps1

Code:
PS1='${debian_chroot:+($debian_chroot)}\t \u $(if [ ${#PWD} -gt 30 ] ; then myPWD="${PWD:0:12}…/\W" ; myPWD="${myPWD:0:25}…" ; else myPWD=$PWD; fi ; echo $myPWD) $ '
It will display full paths smaller than 30 characters entirely, but for longer paths it will get only the first characters of the whole path, and the fist characters of the last folder in the full path.

The end result is something like:

HH:MM:SS tuxguy /home/tuxguy/mystuf.../xmas...
Member
Posted in Uncategorized
Views 657 Comments 0 the dsc is offline
Old

PlayShell 0.2-WP13

Posted 01-08-2013 at 03:17 AM by konsolebox
Updated 01-08-2013 at 03:36 AM by konsolebox

PlayShell 0.2-WP13 was released today.

Hompepage: http://playshell.sourceforge.net/
SF.net summary page: http://sourceforge.net/projects/playshell
Release files: http://sourceforge.net/projects/play...Shell/0.2-WP13
Online repository: http://sourceforge.net/p/playshell/code/
Senior Member
Posted in Projects
Views 548 Comments 0 konsolebox is offline
Old

PlayShell 0.2-WP12A

Posted 12-31-2012 at 08:27 PM by konsolebox

PlayShell 0.2-WP12A was released yesterday.

It's the last version for 2012. Lots of important fixes and improvements were made there. It's pretty stable and consistent already compared to other earlier versions. An overhaul was made.

Hompepage: http://playshell.sourceforge.net/
SF.net summary page: http://sourceforge.net/projects/playshell
Release files: http://sourceforge.net/projects/play...hell/0.2-WP12A
Online repository: http://sourceforge.net/p/playshell/code/
Senior Member
Posted in Projects
Views 577 Comments 0 konsolebox is offline
Old

File conversion script

Posted 12-29-2012 at 10:04 AM by Snark1994
Updated 12-29-2012 at 10:10 AM by Snark1994

A handy script I put together to automatically convert between file formats based on file extension, in an easily extensible manner:

Code:
#!/usr/bin/env bash

#Conversion rules:
# commands["extension_from extension_to"]="convert_command"
# INFILE and OUTFILE in the conversion command are replaced
# with the appropriate filenames

declare -A commands
commands["wav mp3"]="ffmpeg -i INFILE OUTFILE"
...
Senior Member
Posted in Uncategorized
Views 480 Comments 0 Snark1994 is offline
Old

Bash quickie: loop N times, without doing math

Posted 10-22-2012 at 09:07 PM by the dsc (linux-related notes)
Updated 03-10-2013 at 12:25 AM by the dsc (improving, varible version)
Tags bash, loop

I thought that the only way to do such type of loop in Bash would require something like "n=$(($n+1))" within the loop, with the loop being conditioned to "n" adding up to whatever you want, such as "until ((n==30)) ; do". But you can actually do "for i in {1..20} ; do <whatever> ; done". That's somewhat similar to Basic's "for i=1 to 20 ; whatever ; next i".

But it won't work with variables for the starting and ending numbers....
Member
Posted in Uncategorized
Views 729 Comments 0 the dsc is offline

  



All times are GMT -5. The time now is 11:24 PM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration