LinuxAnswers - the LQ Linux tutorial section.
Go Back > Blogs > linux-related notes
User Name


Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
Rate this Entry

Bash/command line - minor variable "editing" without sed

Posted 07-14-2014 at 12:38 AM by the dsc
Updated 07-14-2014 at 03:02 PM by the dsc

$ a=lilolal ; echo ${a/lal/uuu}
To move files "copied" on clipboard (Konqueror/perhaps dolphin) to the place you're on a terminal, without navigating/browsing the folders on the file manager, one can use:

xsel -b | while read f ; do mv -i "${f#*file://}" ./ ; done

As "copied" files on Konqueror are registered on the clipboard as a list with "file://" preceding the path. Perhaps could be aliased to "mvhere" or something like that. (Edit: It seems like it doesn't work as an alias; the variable will vanish into thin digital air. It does work as a function, though (edit 2: for some reason, it seems it only works if there is more than one file "selected"/copied. Weird). I wonder if it would also work just as a pseudo environment variable/array, like $COPIEDFILES, so it would perhaps be more flexible than "mvhere").

I don't fully/minimally get the syntax yet, except for this "sed s"-like substitution, which I just guessed and turns out to work.

More here:
Posted in Uncategorized
Views 309 Comments 0
« Prev     Main     Next »
Total Comments 0




All times are GMT -5. The time now is 04:44 AM.

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