linuxcommand-discuss Mailing List for LinuxCommand (Page 2)
Brought to you by:
bshotts
You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(13) |
Jul
(2) |
Aug
(1) |
Sep
(1) |
Oct
(13) |
Nov
(1) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(1) |
Jul
(1) |
Aug
(1) |
Sep
(1) |
Oct
(1) |
Nov
(1) |
Dec
(1) |
2002 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
(29) |
Sep
(5) |
Oct
(3) |
Nov
(5) |
Dec
(3) |
2003 |
Jan
|
Feb
(2) |
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2004 |
Jan
|
Feb
(11) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(3) |
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: Bram M. <bra...@li...> - 2003-02-16 00:26:53
|
Hi, The signature at the end of this message is generated by two little shell-scripts I wrote: ---sig-linux--- #!/bin/bash echo '<pre>-- ' echo '# Mertens Bram "M8ram" <bra...@li...> Linux User #249103 #' /home/m8ram/bin/sig-general ---end--- ---sig-general--- #!/bin/bash current_uptime=$(uptime) current_kernel=$(uname -r) current_machine=$(uname -m) current_release="SuSE 8.1 Pro" echo -n '# '; echo -n $current_release; echo -n ' kernel '; echo -n $current_kernel; echo -n ' '; echo -n $current_machine; echo ' 128MB RAM #' echo -n '# '; echo -n $current_uptime; echo ' #' echo '</pre>' ---end--- Unfortunately it still doesn't look very pretty, what I would like is something like: ---new-sig--- # Mertens Bram "M8ram" <bra...@li...> Linux User #249103 # # SuSE 8.1 Pro kernel 2.4.19-4GB i686 128MB RAM # # 1:16am up 12:19, 1 user, load average: 0.06, 0.04, 0.06 # ---end--- Is there a shell-function that allows the output to be of certain length like printf in C and Perl (IIRC)? I want all lines to be 78 chars wide, regardless of the kernel-version or the uptime. Is this possible with a shell-script? Or should I write a Perl-script? TIA -- # Mertens Bram "M8ram" <bra...@li...> Linux User #249103 # # SuSE 8.1 Pro kernel 2.4.19-4GB i686 128MB RAM # # 1:16am up 12:19, 1 user, load average: 0.06, 0.04, 0.06 # |
From: Mertens B. <bra...@li...> - 2002-12-10 16:36:16
|
On Tue, 2002-12-10 at 14:49, Norman B. Robinson wrote: > You'll be wanting to take a look at the 'du' command. the '-h' option > makes it easier to interpret and the '-c' option gives you a grand total. > > i.e., "du -ch /home/folder1/" > > As always, check the man page for additional details. Thanks, combined with the -s option to only show the grand total, this is exactly what I needed! Regards -- # Mertens Bram "M8ram" <bra...@li...> Linux User #249103 # # Red Hat Linux 7.3 KDE 3.0.0-10 kernel 2.4.18-3 i686 128MB RAM # # 4:33pm up 19:33, 2 users, load average: 0.46, 0.41, 0.37 # |
From: Norman B. R. <rob...@ze...> - 2002-12-10 14:49:21
|
You'll be wanting to take a look at the 'du' command. the '-h' option makes it easier to interpret and the '-c' option gives you a grand total. i.e., "du -ch /home/folder1/" As always, check the man page for additional details. Enjoy, Norman Mertens Bram wrote: >Hi, > >Is there a way to get the size of a directory on the command line? >Right now I open a Nautilus window select the directory and open the >Preferences window which shows the 'Contents' info: number of files and >total file size. > >Is there any way to do this? > >TIA > > |
From: Mertens B. <bra...@li...> - 2002-12-10 12:59:45
|
Hi, Is there a way to get the size of a directory on the command line? Right now I open a Nautilus window select the directory and open the Preferences window which shows the 'Contents' info: number of files and total file size. Is there any way to do this? TIA -- # Mertens Bram "M8ram" <bra...@li...> Linux User #249103 # # Red Hat Linux 7.3 KDE 3.0.0-10 kernel 2.4.18-3 i686 128MB RAM # # 12:54pm up 15:54, 2 users, load average: 1.30, 0.58, 0.29 # |
From: William S. <bs...@pa...> - 2002-11-24 16:12:25
|
On Sun, 2002-11-24 at 09:49, Mertens Bram wrote: > Hi, > > There are a couple of directories that I need frequently in certain > commands (cd, cp, mv,...) is it possible to create variables that hold > these paths? > > e.g. > instead of typing: cd /mnt/shared/music/lyrcis > type: cd $LYRICS (where $LYRICS is /mnt/shared/music/lyrcis) > > Can I simply add 'LYRICS="/mnt/shared/music/lyrcis"' to my '~/.bashrc'? > > Or is there a better way? > Using an environment variable as you describe is a common approach to this problem. Another way would be to create aliases for the common commands you use. -- ||||| William Shotts, Jr. (bshotts AT panix DOT com) ||||| Be a Linux Commander! Follow me to http://linuxcommand.org |
From: Mertens B. <bra...@li...> - 2002-11-24 14:49:45
|
Hi, There are a couple of directories that I need frequently in certain commands (cd, cp, mv,...) is it possible to create variables that hold these paths? e.g. instead of typing: cd /mnt/shared/music/lyrcis type: cd $LYRICS (where $LYRICS is /mnt/shared/music/lyrcis) Can I simply add 'LYRICS="/mnt/shared/music/lyrcis"' to my '~/.bashrc'? Or is there a better way? TIA -- # Mertens Bram "M8ram" <bra...@li...> Linux User #249103 # # Red Hat Linux 7.3 KDE 3.0.0-10 kernel 2.4.18-3 i686 128MB RAM # # 3:43pm up 4 days, 4:33, 3 users, load average: 1.68, 1.11, 0.94 # |
From: Mertens B. <bra...@li...> - 2002-11-07 15:25:18
|
Thx, After reading your suggestion I checked with my "Linux in a nutshell" for some more info on the -exec and found the -ok option, which basically does the same but asks the users to confirm (much like the -i option of rm). > find ~/evolution -name mbox.ibex -exec rm {} \; so I guess I'll use: find ~/evolution -name mbox.ibe -ok rm {} \; Thx a lot! Regards -- # Mertens Bram "M8ram" <bra...@li...> Linux User #249103 # # Red Hat Linux 7.3 KDE 3.0.0-10 kernel 2.4.18-3 i686 128MB RAM # |
From: William S. <bs...@pa...> - 2002-11-07 15:11:47
|
You could do it with the find command like so: find ~/evolution -name mbox.ibex -exec rm {} \; If you want to do this the hard way: for i in $(find ~/evolution -name mbox.ibex); do echo "Deleting $i" rm $i done DISCLAMIER: I did not test this and it uses rm, so be careful! ||||| William Shotts, Jr. (bshotts AT panix DOT com) ||||| Be a Linux Commander! Follow me to http://linuxcommand.org On 7 Nov 2002, Mertens Bram wrote: > Hi, > > I'm not sure this requires a script, but I don't know how to this using > pipes or i/O redirection... > > Any help with either solution will be greatly appreciated! > > I'm using Evolution 1.0.8 as my mail-client, all mail and data is store > in ~/evolution/ and its subfolders. > > I would like a script or command that checks through ~/evolution > recursively and deletes all files named "mbox.ibex". > > I can find the files with either: > ls lh -R evolution/ | grep ibex > or > find evolution/ -name mbox.ibex > > (when I'm in my home dir off course...) > > Is there a way to pass these files to rm? > > I could copy the rm-commands I now used to delete them all into a script > but then I would have to edit the script every a new subfolder is > created, renamed or deleted... > > TIA > -- > # Mertens Bram "M8ram" <bra...@li...> Linux User #249103 # > # Red Hat Linux 7.3 KDE 3.0.0-10 kernel 2.4.18-3 i686 128MB RAM # > > > > ------------------------------------------------------- > This sf.net email is sponsored by: See the NEW Palm > Tungsten T handheld. Power & Color in a compact size! > http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en > _______________________________________________ > Linuxcommand-discuss mailing list > Lin...@li... > https://lists.sourceforge.net/lists/listinfo/linuxcommand-discuss > |
From: Mertens B. <bra...@li...> - 2002-11-07 14:45:38
|
Hi, I'm not sure this requires a script, but I don't know how to this using pipes or i/O redirection... Any help with either solution will be greatly appreciated! I'm using Evolution 1.0.8 as my mail-client, all mail and data is store in ~/evolution/ and its subfolders. I would like a script or command that checks through ~/evolution recursively and deletes all files named "mbox.ibex". I can find the files with either: ls lh -R evolution/ | grep ibex or find evolution/ -name mbox.ibex (when I'm in my home dir off course...) Is there a way to pass these files to rm? I could copy the rm-commands I now used to delete them all into a script but then I would have to edit the script every a new subfolder is created, renamed or deleted... TIA -- # Mertens Bram "M8ram" <bra...@li...> Linux User #249103 # # Red Hat Linux 7.3 KDE 3.0.0-10 kernel 2.4.18-3 i686 128MB RAM # |
From: Karl V. <vo...@dn...> - 2002-10-23 16:29:55
|
>> In a previous message, "William Shotts" <bs...@pa...> said: B> I am experimenting with a more style sheet oriented approach to coding B> the Linuxcommand.org web pages, but since Netscape 4.x has such poor B> support for CSS, I wanted to know if anybody uses Netscape 4.x rather B> than something newer like Netscape 6.x or 7.x. I use 4.79 and had no trouble displaying http://linuxcommand.org/experimental.html -- Karl Vogel ASC/YCOA, Wright-Patterson AFB, OH 45433 vo...@dn... http://www.dnaco.net/~vogelke Pig: An animal (Porcus omnivorous) closely allied to the human race by the splendor and vivacity of its appetite, which, however, is inferior in scope, for it balks at pig. --Ambrose Bierce, "The Devil's Dictionary" |
From: Bruce B. <bbu...@ea...> - 2002-10-19 20:15:43
|
----- Original Message ----- From: "William Shotts" <bs...@pa...> To: <lin...@li...> Sent: Saturday, October 19, 2002 11:51 AM Subject: [Linuxcommand-discuss] Is anybody using Netscape 4.x anymore? > I am experimenting with a more style sheet oriented approach to coding > the Linuxcommand.org web pages, but since Netscape 4.x has such poor > support for CSS, I wanted to know if anybody uses Netscape 4.x rather > than something newer like Netscape 6.x or 7.x. > > I have an experimental, prototype page at: > > http://linuxcommand.org/experimental.html > > which demonstrates the new technique. It look like the old pages for the > most part but is a much cleaner to code and helps me achieve better > standards compliance. > - Hi Bill, Looks fine to me. But I'm using IE here and use w3m on Linux. The list on the upper left a.. LinuxCommand b.. Learning the shell c.. Writing shell scripts d.. Script library e.. SuperMan pages f.. Who, What, Where, Why only shows up from nuxCommand onward. Glad to know this is still happening. I am spread very thin at the moment and able to devote only a small amount of time to learning scripting. Have made some improvements to my file explorer, however: #!/bin/bash #fe by Bruce<+> gf () { select com in less zless file "ls -laF" w3m "rm -i" ; do $com $fname return done } while : ; do select fname in $HOME / EXIT $(ls -aF) ; do if [ "$fname" = EXIT ] ; then exit; fi if [ -f "$fname" ] ; then gf elif [ -d "$fname" ] ; then cd "$fname" echo "$PWD" break fi done done Bruce<+> - > ||||| William Shotts, Jr. (bshotts AT panix DOT com) > ||||| Be a Linux Commander! Follow me to http://linuxcommand.org > > > ------------------------------------------------------- > This sf.net email is sponsored by: > Access Your PC Securely with GoToMyPC. Try Free Now > https://www.gotomypc.com/s/OSND/DD > _______________________________________________ > Linuxcommand-discuss mailing list > Lin...@li... > https://lists.sourceforge.net/lists/listinfo/linuxcommand-discuss |
From: William S. <bs...@pa...> - 2002-10-19 18:50:54
|
I am experimenting with a more style sheet oriented approach to coding the Linuxcommand.org web pages, but since Netscape 4.x has such poor support for CSS, I wanted to know if anybody uses Netscape 4.x rather than something newer like Netscape 6.x or 7.x. I have an experimental, prototype page at: http://linuxcommand.org/experimental.html which demonstrates the new technique. It look like the old pages for the most part but is a much cleaner to code and helps me achieve better standards compliance. -- ||||| William Shotts, Jr. (bshotts AT panix DOT com) ||||| Be a Linux Commander! Follow me to http://linuxcommand.org |
From: Bruce B. <bbu...@ea...> - 2002-09-09 00:10:13
|
----- Original Message ----- From: "Steve Sanders" <st...@th...> To: <lin...@li...> Sent: Sunday, September 08, 2002 10:27 AM Subject: [Linuxcommand-discuss] finding hidden files Greetings all! I am new to the list so I apologize if this question is out of place because it is too basic. I am taking a class at college on Linux. We are completing a lab, and one of the questions was to determine how many hidden files there are in the /etc directory. I found the answer using: ls -a I am just wondering if there is a way to just display the hidden files. I tried using: ls -a | grep .* but it seemed to ignore the . and just display everything. [ grep uses regular expressions, and the . dot means to substitute one character for it.. It is a wild card... escape the dot like so: \. ] I tried several other things as well, but everything seemed to just ignore the ".". So, does anyone know a way to just display the hidden files in the /etc directory? Thanks for the help. Steve [Welcome Steve........ If you want to display the hidden files do: $ cat /etc/.* then use Shift+PageUp/PageDown to scroll back and forward.... If it is a really long list, pipe it to less: $ cat /etc/.* | less This is from the console.....I don't use X. To get to a real console (instead of an Xterm) do Ctrl+LeftAlt and F1-6, then login. Bruce<+> ] |
From: Steve S. <st...@th...> - 2002-09-08 22:34:41
|
Thanks for all the help! Steve |
From: William S. <wes...@co...> - 2002-09-08 18:06:34
|
On Sunday 08 September 2002 01:27 pm, Steve Sanders wrote: > Greetings all! I am new to the list so I apologize if this question is out > of place because it is too basic. I am taking a class at college on Linux. > We are completing a lab, and one of the questions was to determine how > many hidden files there are in the /etc directory. I found the answer > using: ls -a > I am just wondering if there is a way to just display the hidden files. I > tried using: ls -a | grep .* > but it seemed to ignore the . and just display everything. I tried several > other things as well, but everything seemed to just ignore the ".". So, > does anyone know a way to just display the hidden files in the /etc > directory? Thanks for the help. > > Steve If you want to know the number of hidden files in /etc and all of its subdirectories, try: find /etc -type f -name ".*" | wc -l If you just want the number of hidden files in /etc (not its subdirectories), try: find /etc -type f -name ".*" -maxdepth 1 | wc -l To use ls to get an approximate list of the hidden files (plus the . and .. entries), try: ls -d .* -- ||||| William Shotts, Jr. (bshotts AT panix DOT com) ||||| Be a Linux Commander! Follow me to http://linuxcommand.org |
From: Alaa T. G. <al...@an...> - 2002-09-08 18:01:32
|
On Sun, 8 Sep 2002 12:27:38 -0500 Steve Sanders wrote: > does anyone know a way to just display the hidden files in the /etc > directory? Thanks for the help. ls /etc/.* this would also list the contents of any hidden directory so if you only want to list the direcotory names only use the -d flag this way ls /etc/.* -d cheers, Alaa -- Perilous to all of us are the devices of an art deeper than we ourselves possess. -- Gandalf the Grey [J.R.R. Tolkien, "Lord of the Rings"] |
From: Steve S. <st...@th...> - 2002-09-08 17:27:38
|
Greetings all! I am new to the list so I apologize if this question is = out of place because it is too basic. I am taking a class at college on = Linux. We are completing a lab, and one of the questions was to = determine how many hidden files there are in the /etc directory. I = found the answer using: ls -a =20 I am just wondering if there is a way to just display the hidden files. = I tried using:=20 ls -a | grep .* but it seemed to ignore the . and just display everything. I tried = several other things as well, but everything seemed to just ignore the = ".". So, does anyone know a way to just display the hidden files in the = /etc directory? Thanks for the help. Steve |
From: Bruce B. <bbu...@ea...> - 2002-08-29 20:00:02
|
Alaa--- I got your rough draft and will send it back annotated in a few days.... Just read the "case" lesson in Bill's tutorial, and made the following crude improvement to the fe script: (sure wish I knew how to make the output page without using Shift + PageUp/PageDown.......[ which in a huge directory like /dev would run off the scrollback buffer ] ) #!/bin/bash ###2.05 case $1 in -l) XX=less ;; -f) XX=file ;; -z) XX=zless ;; -ll) XX="ls -lah" ;; -h) XX=w3m ;; *) echo "Usage: You must use one of these options: -l for less -f for file -z for zless -ll for ls -lah -h for w3m " exit 1 ;; esac while : ; do select fname in $HOME / EXIT $(ls -aF) ; do if [ "$fname" = EXIT ] ; then echo "$PWD" > /home/farley931/.t2 exit; fi if [ -f "$fname" ] ; then echo echo ${XX} "$fname" echo echo elif [ -d "$fname" ] ; then cd "$fname" echo "$PWD" break fi done done Bruce<+> |
From: Alaa T. G. <al...@an...> - 2002-08-29 18:12:31
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thu, 29 Aug 2002 11:09:06 -0700 lin...@li... wrote: > Your mail to 'Linuxcommand-discuss' with the subject > > Re: [Linuxcommand-discuss] Greetings & a Script > > Is being held until the list moderator can review it for approval. > > The reason it is being held: > > Message body is too big: 80981 bytes but there's a limit of 40 > KB > > Either the message will get posted to the list, or you will receive > notification of the moderator's decision. this message was not supposed to go to the list, I'm sorry please remove it. sorry again, Alaa - -- Perilous to all of us are the devices of an art deeper than we ourselves possess. -- Gandalf the Grey [J.R.R. Tolkien, "Lord of the Rings"] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE9bmMfqIWBQ7ecPHcRAsQwAJ9N5rJbOBgH9w0QdlQ47jkQZADeDQCffKvK hgO/mIQq+eJKWMd/h81gW7s= =Dcip -----END PGP SIGNATURE----- |
From: Alaa T. G. <al...@an...> - 2002-08-29 18:10:31
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 ooops very sorry for sending this on the list, I didn't realize what I was doing until it was too late, sorry. Alaa -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE9bmKnqIWBQ7ecPHcRAsJrAJ97ZuiSdjWfjyG6Ti2UyzU4KH4Q6wCePIs7 bBoO9BuoZ3iTErsIab4TVW0= =hzEu -----END PGP SIGNATURE----- |
From: Bruce B. <bbu...@ea...> - 2002-08-29 17:33:27
|
----- Original Message ----- From: "Alaa The Great" <al...@an...> To: <lin...@li...> Sent: Thursday, August 29, 2002 9:55 AM Subject: Re: [Linuxcommand-discuss] Greetings & a Script > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On Thu, 29 Aug 2002 09:27:51 -0700 > "Bruce Burhans" <bbu...@ea...> wrote: > > > > > I was referring to files transferred from that legacy > > system....... > > yes thats why I have to make my scripts space safe, most of my media > files are from the dark days when all I had was TLS :-) > > > > yes it works because of the back ticks which puts the output of > > > basename in front of echo. > > > > Yes, I caught that.......Bill says that backticks are > > ugly and to use $( ). But more is involved : With a > > poor editor like the one in OE, it is very hard to tell > > whether they are forward or back quotes..... > > but on the other hand they are identical?? or is there a difference?? > I prefer the backticks brackets in front of a dollar sign have many > meaning its confusing to memorize them all, anyways I use mcedit when > I'm writing bash script, backticks have a black background which makes > them very visible against the blue screen. > > > THAT is valuable information....And until now I had > > no clue......It is hard to relate to bash as just another > > executable..... > yes but it makes sense, I use this alot to do jobs like > > find files using locate or find | filter with grep etc | add a command > in front of each line using awk | bash to execute this script > > locate core | grep "/core$" | awk '{print "rm " $0}' | bash > > and it removes all core files (or at least all core files the slocate > data base knows about) > > and a small script (a wrapper really) to rename mp3 files according to > their id3 data, it uses mp3info for this. > > #!/bin/bash > #mp3rename > > for i in $*; > do > mp3info -p "mv \"%f\" \"%a_-_%t.mp3\"\n" "$i" | grep -v "_-_.mp3" > |tr [\'\;\&] " "; > > done > > I need an ogg one but ogginfo isn't as flexible as mp3info anyone with > ideas?? > > I'm also thinking about one that does the opposite (change id tags > according to filenames) > > BTW I'm writing a command line and Bash tutorial for my LUG, > unfortunatly I have to write in English first and then translate it > to my native language arabic (it is much easier this way) anypne care > to review it for me I really need feedback. > Be happy to, IF you think I am qualified....Have yet to even begin learning AWK.........Send in plain text if possible, in the main body of the message..... Your English is excellent.... Bruce<+> > cheers, > Alaa > > - -- > Perilous to all of us are the devices of an art deeper than we > ourselves > possess. > -- Gandalf the Grey [J.R.R. Tolkien, "Lord of the > Rings"] > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.0.6 (GNU/Linux) > > iD8DBQE9blINqIWBQ7ecPHcRAhIeAJ9I25GB7e2cloBcSxHkKUkFW2cNzgCdECyl > qyDXBo+Crv3pOD/A8pklJW8= > =iR/r > -----END PGP SIGNATURE----- > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Linuxcommand-discuss mailing list > Lin...@li... > https://lists.sourceforge.net/lists/listinfo/linuxcommand-discuss |
From: Alaa T. G. <al...@an...> - 2002-08-29 16:59:44
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thu, 29 Aug 2002 09:27:51 -0700 "Bruce Burhans" <bbu...@ea...> wrote: > > I was referring to files transferred from that legacy > system....... yes thats why I have to make my scripts space safe, most of my media files are from the dark days when all I had was TLS :-) > > yes it works because of the back ticks which puts the output of > > basename in front of echo. > > Yes, I caught that.......Bill says that backticks are > ugly and to use $( ). But more is involved : With a > poor editor like the one in OE, it is very hard to tell > whether they are forward or back quotes..... but on the other hand they are identical?? or is there a difference?? I prefer the backticks brackets in front of a dollar sign have many meaning its confusing to memorize them all, anyways I use mcedit when I'm writing bash script, backticks have a black background which makes them very visible against the blue screen. > THAT is valuable information....And until now I had > no clue......It is hard to relate to bash as just another > executable..... yes but it makes sense, I use this alot to do jobs like find files using locate or find | filter with grep etc | add a command in front of each line using awk | bash to execute this script locate core | grep "/core$" | awk '{print "rm " $0}' | bash and it removes all core files (or at least all core files the slocate data base knows about) and a small script (a wrapper really) to rename mp3 files according to their id3 data, it uses mp3info for this. #!/bin/bash #mp3rename for i in $*; do mp3info -p "mv \"%f\" \"%a_-_%t.mp3\"\n" "$i" | grep -v "_-_.mp3" |tr [\'\;\&] " "; done I need an ogg one but ogginfo isn't as flexible as mp3info anyone with ideas?? I'm also thinking about one that does the opposite (change id tags according to filenames) BTW I'm writing a command line and Bash tutorial for my LUG, unfortunatly I have to write in English first and then translate it to my native language arabic (it is much easier this way) anypne care to review it for me I really need feedback. cheers, Alaa - -- Perilous to all of us are the devices of an art deeper than we ourselves possess. -- Gandalf the Grey [J.R.R. Tolkien, "Lord of the Rings"] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE9blINqIWBQ7ecPHcRAhIeAJ9I25GB7e2cloBcSxHkKUkFW2cNzgCdECyl qyDXBo+Crv3pOD/A8pklJW8= =iR/r -----END PGP SIGNATURE----- |
From: Bruce B. <bbu...@ea...> - 2002-08-29 16:28:01
|
----- Original Message ----- From: "Alaa The Great" <al...@an...> To: "Bruce Burhans" <bbu...@ea...> Sent: Thursday, August 29, 2002 12:48 AM Subject: Re: [Linuxcommand-discuss] Greetings & a Script > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On Wed, 28 Aug 2002 20:15:34 -0700 > "Bruce Burhans" <bbu...@ea...> wrote: > > > > > I modified it a bit to be handle filenames with spaces (they are > > > not a good idea I know) > > > > > They are a drag...Linux doesn't know how to cope with them.....I > > end up > > having to do mv foo* and ls > > divides the names into seperate filenames..... > > it copes with them fine if you know bash quoting rules, they are very > complex however and I always have to try several combinations before I > get it right. > I was referring to files transferred from that legacy system....... > > > > #!/bin/bash > > > old=$1 > > > new=$2 > > > for i in *$old; > > > do > > > echo mv \"$i\" \"`basename "$i" $old`$new\"; > > > done > > > > > > > this works without the $k part? Sure looks like it > > would...... Will > > yes it works because of the back ticks which puts the output of > basename in front of echo. > Yes, I caught that.......Bill says that backticks are ugly and to use $( ). But more is involved : With a poor editor like the one in OE, it is very hard to tell whether they are forward or back quotes..... > > have to try it....What if there IS no space....? If it works it > > sure is efficient.......... > of course it works if there are no spaces, it handles any other > special character except the double quote itself. > > > How do you pipe something on stdout to bash? > sh foo | bash > > this pipes the output of the script foo to bash > > if foo is executable then simply > > foo | bash > > this is one of the things that no one tells you, bash reads from stdin > like any other GNU command. > THAT is valuable information....And until now I had no clue......It is hard to relate to bash as just another executable..... > I use this technique all the time specially because of bad filenames, > you can never be sure what your script is going to do. > > P.S. loved the fe script, it amazing how much you can achieve in few > lines, maybe you should work on adding more options > Thanks. It would be nice to have one to run <file> or <ls -lha> or <zless> instead of <less>......Needs a few real registers (In RAM, which I don't know how to create Would you just create a ramdisk?) for file operations like cp and mv....... Here's a simple script I wrote so that I could have a running clock to set my house clock.... blah while : do date sleep 1 clear done # ^c to exit . Bruce<+> > > cheers, > Alaa > - -- > Perilous to all of us are the devices of an art deeper than we > ourselves > possess. > -- Gandalf the Grey [J.R.R. Tolkien, "Lord of the > Rings"] > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.0.6 (GNU/Linux) > > iD8DBQE9bdHfqIWBQ7ecPHcRAhY2AJ9PveFole60a+LA0RqkDNDvO171pgCffwQ0 > fcfAztidmRlWRTrDFDOj14E= > =0fkM > -----END PGP SIGNATURE----- |
From: Bruce B. <bbu...@ea...> - 2002-08-29 03:16:20
|
----- Original Message ----- From: "William Shotts" <wes...@co...> To: <lin...@li...> Sent: Wednesday, August 28, 2002 7:14 PM Subject: Re: [Linuxcommand-discuss] Greetings & a Script > On Wednesday 28 August 2002 08:36 pm, Bruce Burhans wrote: > > > > First, you could simplify it by doing the following: > > > > > > #!/bin/bash > > > > > > old=$1 > > > new=$2 > > > > > > for i in *$old; do > > > k=$(basename $i $old) > > > mv $i $k$new > > > done > > > > > > I haven't tested this, but it looks right ;-) > > > > Bill.....I have bad news and good news..... > > > > The script above puts the new extension on every file > > in the directory, regardless of its present extension... > > The test part is needed.... > > Try it again Bruce. The "for" will only select files that have the old > extension. Make sure you are using: > > for i in *$old; > > and not > > for i in * $old; > > If you include a space between the "*" and the "$old", it will process all > the files. Ahh! Oops! Dot thy i's and cross thy t's..... > > > > > I am a good way through your scripting tutorial, and it > > is the best one out of a half-dozen I have on my box.. > > > > You take the time to explain what is going on, to answer > > obvious questions that pop up, and are oriented towards > > functionality. For example: Not one of the other tutorials > > mentions that you bash has a help command..... > > > > I've read the entire bash reference manual, and had no > > idea that such a thing existed.......Nor do any of them > > tell you that you put a function in your .bashrc.....! > > (why don't you need to chmod +rx it ? ) or enter them > > on the cli..... > > You don't need to make it executable because it's not executed, it's sourced. > That is, it is read as input by another script, usually .bash_profile. > > > You have the makings of a really good book there... > > (e or otherwise ) > > Maybe someday. I'd be happy just to have enough time to write the next > lesson. > Am looking forward to it..... Bruce<+> > -- > ||||| William Shotts, Jr. (bshotts AT panix DOT com) > ||||| Be a Linux Commander! Follow me to http://linuxcommand.org > > > ------------------------------------------------------- > This sf.net email is sponsored by: Jabber - The world's fastest growing > real-time communications platform! Don't just IM. Build it in! > http://www.jabber.com/osdn/xim > _______________________________________________ > Linuxcommand-discuss mailing list > Lin...@li... > https://lists.sourceforge.net/lists/listinfo/linuxcommand-discuss |
From: William S. <wes...@co...> - 2002-08-29 02:21:50
|
On Wednesday 28 August 2002 08:53 pm, Alaa The Great wrote: > nice script, > I modified it a bit to be handle filenames with spaces (they are not a > good idea I know) > > #!/bin/bash > old=$1 > new=$2 > for i in *$old; > do > echo mv \"$i\" \"`basename "$i" $old`$new\"; > done > > > I prefer it to print the commands on stdout first just to make sure > that everything is OK and then pipe the output to bash for the actual > renaming to happen. > > cheers, > Alaa Yes! That is an excellent technique for testing your work. Everybody should look at this and see how Alaa is using echo to see the command that is created. I do this same trick all the time while I am developing. -- ||||| William Shotts, Jr. (bshotts AT panix DOT com) ||||| Be a Linux Commander! Follow me to http://linuxcommand.org |