linuxcommand-discuss Mailing List for LinuxCommand
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: Ania <pi...@gm...> - 2011-09-18 12:52:45
|
It seems that I always find a solution right after posting a question to a forum, so hopefully it will happen again this time ;) I figured out how to scale images and read their dimensions, and now I only have to rename the batch so that it can appear as a sequence in the movie. I successfuly changed file extensions from uppercase to lowercase, and looks like I'm almost there... I wrote this command line: rename -n -v 's/(\d{8})\.jpg$/new_file_name_$1\.jpg' *.jpg to rename photos with 8-digit names (they are like "DSC_5889.jpg") to sequence name followed by a number. I don't know if this 8-digit rule is necessary if I want to rename all of them? Anyway, the answer was: Substitution replacement not terminated at (eval 1) line 1. I suppose that this command is correct as it worked with changing the extension so maybe there is something wrong with this 8-digit rule? Regards, Ania On 09/18/2011 11:40 AM, Ania wrote: > Hello, > this is my first experience with Terminal so I am a complete newbie :) > but I need it to process multiple images which are to be used later in > a video. > The first thing that I wanted to do was to minify the images of one > sequence. I keep images for each sequence in separate folders. To make > sure that the scaling will be proportional, I divided the original > size by four and scaled first one of them with Gimp. These are the > image dimensions: > Width: 2592 Height: 3872 > And four times smaller: > Width: 648 Height: 968 > The target image should have height 480 because the video will be > 720x480, but I didn't know how to write a command to change only > height and adjust width proportionally, so to avoid distorting them I > separated vertical images from horizontal in different folders. When > the images are close to the target size I want to crop them (not sure > how to do it yet). > I wrote this command line: > mogrify -convert -size 648x968 *.jpg -resize 648x968 > And the answer was: > mogrify: unrecognized option `-convert' @ > error/mogrify.c/MogrifyImageCommand/4560. > > What am I doing wrong? > |
From: Ania <pi...@gm...> - 2011-09-18 08:40:36
|
Hello, this is my first experience with Terminal so I am a complete newbie :) but I need it to process multiple images which are to be used later in a video. The first thing that I wanted to do was to minify the images of one sequence. I keep images for each sequence in separate folders. To make sure that the scaling will be proportional, I divided the original size by four and scaled first one of them with Gimp. These are the image dimensions: Width: 2592 Height: 3872 And four times smaller: Width: 648 Height: 968 The target image should have height 480 because the video will be 720x480, but I didn't know how to write a command to change only height and adjust width proportionally, so to avoid distorting them I separated vertical images from horizontal in different folders. When the images are close to the target size I want to crop them (not sure how to do it yet). I wrote this command line: mogrify -convert -size 648x968 *.jpg -resize 648x968 And the answer was: mogrify: unrecognized option `-convert' @ error/mogrify.c/MogrifyImageCommand/4560. What am I doing wrong? |
From: Bryan H. <bh...@gm...> - 2011-08-21 19:28:26
|
Hi, I've been trying to learn scripting from the tutorial online. I believe I found an error in the script. In part 3, flow control we edit a function home_space and have the following line printf "$format" $total_dirs $total_files $total_blocks http://linuxcommand.org/wss0140.php $format is defined to take 4 arguments, and since total_blocks=$(du -s $home_dir) which gives the number of blocks followed by the name of the directory, it seems that we assume that $total_blocks will resolve into two arguments which together with $total_dirs and $total_files gives a sum total of 4 arguments. However, I found that $total_blocks was being treated as one argument even though it has two tokens. Without looking at the shell code, I believe that the assignment of arguments in printf is somehow happening BEFORE the shell is interpreting the variables. My work around was to do this: total_blocks=$(du -s $home_dir | sed -e "s/[ \t].*//") printf "$format" $total_dirs $total_files $total_blocks $home_dir Can someone confirm and clarify this behavior? The tutorial seems to suggest that the variables are interpreted by the shell before anything else, which is counter to the behavior that I'm seeing. Thank you, Bryan |
From: William S. <bs...@pa...> - 2009-10-15 22:02:12
|
Sum Abiut wrote: > Hi, > > I am new to scripting; wanting to write a backup script that will backup my file from a local PC to a remote PC but I don’t know how to start. > > Can someone please point me to the right direction? > > > > Thanks in advance > > > > Sum I think a good first step is to state very clearly, exactly what you want to do. If you are new to scripting, keep your objective simple. Make it more ambitious as you become more skilled. -- -- ||||| William Shotts, Jr. (bshotts AT panix DOT com) ||||| Be a Linux Commander! Follow me to http://linuxcommand.org ||||| See My Photography! http://www.williamshottsphotography.com |
From: narendra s. <nar...@gm...> - 2009-10-13 12:50:05
|
On Tue, Oct 13, 2009 at 5:07 PM, Sum Abiut <sa...@va...> wrote: > Hi, > > I am new to scripting; wanting to write a backup script that will backup my > file from a local PC to a remote PC but I don’t know how to start. > > Can someone please point me to the right direction? > > > > Thanks in advance > > > > Sum > You can read some backup script from http://lug-iitd.org/Articles/Linux_Backup These are under process by some member and i request other to modify them to make them usable -- ┌─────────────────────────┐ │ Narendra Sisodiya ( नरेन्द्र सिसोदिया ) │ Web : http://narendra.techfandu.org │ Twitter : http://tinyurl.com/dz7e4a └─────────────────────────┘ |
From: Sum A. <sa...@va...> - 2009-10-13 08:54:31
|
Hi, I am new to scripting; wanting to write a backup script that will backup my file from a local PC to a remote PC but I don't know how to start. Can someone please point me to the right direction? Thanks in advance Sum |
From: john h. <joh...@ya...> - 2006-10-13 08:01:56
|
Requesting for linuxcommands --------------------------------- Find out what India is talking about on - Yahoo! Answers India Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it NOW |
From: William S. <bs...@pa...> - 2006-01-13 00:45:05
|
On Mon, 2006-01-09 at 12:38, Bram Mertens wrote: > Hi > > I've been looking into using getopts for processing options passed to > a script. However I would like to be able to use long option-names. > I don't see how this can be done with getopts. For C there appears to > be a getopt_long is there anything similar for bash? Interesting question. After a little creative Googling, I came across this: http://www.linuxcommand.org/man_pages/getopt1.html (which also demonstrates my need to correct the character encoding of the SuperMan pages ;-) -- ||||| William Shotts, Jr. (bshotts AT panix DOT com) ||||| Be a Linux Commander! Follow me to http://linuxcommand.org ||||| See My Photography! http://www.williamshottsphotography.com |
From: Bram M. <bra...@so...> - 2006-01-09 17:38:12
|
Hi I've been looking into using getopts for processing options passed to a script. However I would like to be able to use long option-names. I don't see how this can be done with getopts. For C there appears to be a getopt_long is there anything similar for bash? TIA Bram Mertens p.s. sorry for posting this again - I subscribed with the wrong address before. |
From: Bram M. <bra...@so...> - 2006-01-09 12:09:11
|
Hi I've been looking into using getopts for processing options passed to a script. However I would like to be able to use long option-names. I don't see how this can be done with getopts. For C there appears to be a getopt_long is there anything similar for bash? TIA Bram Mertens |
From: Bram M. <bra...@li...> - 2004-02-24 07:57:38
|
On Mon, 2004-02-23 at 21:01, Norman Robinson wrote: > Just wondering; > Is a text version somehow better than using the man > pages? With a text-version of the website I meant the 'learning the shell' and 'writing shell scripts' part. AFAIK there aren't any man pages for those. Well obviously there is man bash but then I'd say: yes a text version [of these two HOWTOs] would be much more readable than man bash... Regards -- # Mertens Bram "M8ram" <bra...@li...> Linux User #249103 # # SuSE Linux 8.2 (i586) kernel 2.4.20-4GB i686 256MB RAM # # 8:45am up 32 days 12:24, 7 users, load average: 0.17, 0.22, 0.25 # |
From: Norman R. <nor...@ya...> - 2004-02-23 20:09:55
|
Just wondering; Is a text version somehow better than using the man pages? N. --- Bram Mertens <bra...@li...> wrote: > Hi > > Could you provide a (plain text) downloadable > version of the website? I > believe it would be nice to be able to read through > the HOWTO's using > less, e.g. so you would be able to search for > keywords. > > Since you redesigned the website using php this > might even be relatively > easy. > > TIA > -- > # Mertens Bram "M8ram" <bra...@li...> > Linux User #249103 # > # SuSE Linux 8.2 (i586) kernel 2.4.20-4GB i686 > 256MB RAM # > # 6:31pm up 29 days 22:09, 10 users, load > average: 0.21, 0.16, 0.16 # > > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps > Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > Linuxcommand-discuss mailing list > Lin...@li... > https://lists.sourceforge.net/lists/listinfo/linuxcommand-discuss > > |
From: William S. <bs...@pa...> - 2004-02-21 21:31:39
|
Yes, I have gotten that request a number of times. I will look into it. ||||| William Shotts, Jr. (bshotts AT panix DOT com) ||||| Be a Linux Commander! Follow me to http://linuxcommand.org On Sat, 21 Feb 2004, Bram Mertens wrote: > Hi > > Could you provide a (plain text) downloadable version of the website? I > believe it would be nice to be able to read through the HOWTO's using > less, e.g. so you would be able to search for keywords. > > Since you redesigned the website using php this might even be relatively > easy. > > TIA > -- > # Mertens Bram "M8ram" <bra...@li...> Linux User #249103 # > # SuSE Linux 8.2 (i586) kernel 2.4.20-4GB i686 256MB RAM # > # 6:31pm up 29 days 22:09, 10 users, load average: 0.21, 0.16, 0.16 # > |
From: Bram M. <bra...@li...> - 2004-02-21 17:41:23
|
Hi Could you provide a (plain text) downloadable version of the website? I believe it would be nice to be able to read through the HOWTO's using less, e.g. so you would be able to search for keywords. Since you redesigned the website using php this might even be relatively easy. TIA -- # Mertens Bram "M8ram" <bra...@li...> Linux User #249103 # # SuSE Linux 8.2 (i586) kernel 2.4.20-4GB i686 256MB RAM # # 6:31pm up 29 days 22:09, 10 users, load average: 0.21, 0.16, 0.16 # |
From: William S. <bs...@pa...> - 2004-02-11 22:47:42
|
You got it. ||||| William Shotts, Jr. (bshotts AT panix DOT com) ||||| Be a Linux Commander! Follow me to http://linuxcommand.org |
From: Bram M. <bra...@li...> - 2004-02-11 22:34:26
|
On Wed, 2004-02-11 at 23:26, Bram Mertens wrote: [...] > Thanks that did it indeed, I also changed: > echo "" >> $LOGFILE > echo "--- $(date +"%R %A, %B %-d, %Y") ---" >> $LOGFILE > to: > echo "\n--- $(date +"%R %A, %B %-d, %Y") ---" >> $LOGFILE Hmm that didn't work as expected either, after looking at `info echo` I realised it had to be: echo -e "\n--- $(date +"%R %A, %B %-d, %Y") ---" >> $LOGFILE Regards -- # Mertens Bram "M8ram" <bra...@li...> Linux User #249103 # # SuSE 8.2 Pro kernel 2.4.20-4GB i686 128MB RAM # # 11:32pm up 20 days 3:10, 5 users, load average: 0.44, 0.19, 0.08 # |
From: Bram M. <bra...@li...> - 2004-02-11 22:27:08
|
On Wed, 2004-02-11 at 18:56, William Shotts wrote: > I see your problem. See my comment below... [...] > > $LOGFILE="/data/logs/evolution.log" > > This is wrong. > It should be: > > LOGFILE="/data/logs/evolution.log" > > No leading "$". $ tells bash to perform a substition. It does not > indicate a variable type as it would in say VisualBasic. Thanks that did it indeed, I also changed: echo "" >> $LOGFILE echo "--- $(date +"%R %A, %B %-d, %Y") ---" >> $LOGFILE to: echo "\n--- $(date +"%R %A, %B %-d, %Y") ---" >> $LOGFILE Just to clean things up. Regards Bram -- # Mertens Bram "M8ram" <bra...@li...> Linux User #249103 # # SuSE 8.2 Pro kernel 2.4.20-4GB i686 128MB RAM # # 11:26pm up 20 days 3:04, 5 users, load average: 0.01, 0.05, 0.01 # |
From: William S. <bs...@pa...> - 2004-02-11 17:57:31
|
I see your problem. See my comment below... ||||| William Shotts, Jr. (bshotts AT panix DOT com) ||||| Be a Linux Commander! Follow me to http://linuxcommand.org On Wed, 11 Feb 2004, Bram Mertens wrote: > On Wed, 2004-02-11 at 15:51, William Shotts wrote: > > Yes, by all means you would want to use a variable instead. It would make > > your script easier to maintain. I would suggest that in keeping with > > convention, the name of the variable should have an uppercase name since > > it you are treating the variable as a constant. > > After editing the script I get the following errors: > m8ram@linux:~> bin/startevo > bin/startevo: line 3: =/data/logs/evolution.log: No such file or directory > bin/startevo: line 4: $LOGFILE: ambiguous redirect > bin/startevo: line 5: $LOGFILE: ambiguous redirect > bin/startevo: line 6: $LOGFILE: ambiguous redirect > > This is what the script looks like now: > m8ram@linux:~> cat bin/startevo > #!/bin/bash > > $LOGFILE="/data/logs/evolution.log" This is wrong. It should be: LOGFILE="/data/logs/evolution.log" No leading "$". $ tells bash to perform a substition. It does not indicate a variable type as it would in say VisualBasic. Also, I assume that /data/logs exists and you have permission to read/write a file in that directory. > echo "" >> $LOGFILE > echo "--- $(date +"%R %A, %B %-d, %Y") ---" >> $LOGFILE > evolution >> $LOGFILE 2>&1 > > The file does exist and is writable: > m8ram@linux:~> ls -lh /data/logs/evolution.log > -rw-r--r-- 1 m8ram users 50K 2004-02-11 16:58 /data/logs/evolution.log > > Why is bash looking for a file called '=/data/logs/evolution.log' ? The > quotes are correct, aren't they? > > TIA > -- > # Mertens Bram "M8ram" <bra...@li...> Linux User #249103 # > # SuSE 8.2 Pro kernel 2.4.20-4GB i686 128MB RAM # > # 5:06pm up 19 days 20:43, 5 users, load average: 0.56, 0.20, 0.10 # > > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > Linuxcommand-discuss mailing list > Lin...@li... > https://lists.sourceforge.net/lists/listinfo/linuxcommand-discuss > |
From: Bram M. <bra...@li...> - 2004-02-11 16:11:00
|
On Wed, 2004-02-11 at 15:51, William Shotts wrote: > Yes, by all means you would want to use a variable instead. It would make > your script easier to maintain. I would suggest that in keeping with > convention, the name of the variable should have an uppercase name since > it you are treating the variable as a constant. After editing the script I get the following errors: m8ram@linux:~> bin/startevo bin/startevo: line 3: =/data/logs/evolution.log: No such file or directory bin/startevo: line 4: $LOGFILE: ambiguous redirect bin/startevo: line 5: $LOGFILE: ambiguous redirect bin/startevo: line 6: $LOGFILE: ambiguous redirect This is what the script looks like now: m8ram@linux:~> cat bin/startevo #!/bin/bash $LOGFILE="/data/logs/evolution.log" echo "" >> $LOGFILE echo "--- $(date +"%R %A, %B %-d, %Y") ---" >> $LOGFILE evolution >> $LOGFILE 2>&1 The file does exist and is writable: m8ram@linux:~> ls -lh /data/logs/evolution.log -rw-r--r-- 1 m8ram users 50K 2004-02-11 16:58 /data/logs/evolution.log Why is bash looking for a file called '=/data/logs/evolution.log' ? The quotes are correct, aren't they? TIA -- # Mertens Bram "M8ram" <bra...@li...> Linux User #249103 # # SuSE 8.2 Pro kernel 2.4.20-4GB i686 128MB RAM # # 5:06pm up 19 days 20:43, 5 users, load average: 0.56, 0.20, 0.10 # |
From: William S. <bs...@pa...> - 2004-02-11 14:51:42
|
Yes, by all means you would want to use a variable instead. It would make your script easier to maintain. I would suggest that in keeping with convention, the name of the variable should have an uppercase name since it you are treating the variable as a constant. ||||| William Shotts, Jr. (bshotts AT panix DOT com) ||||| Be a Linux Commander! Follow me to http://linuxcommand.org On Wed, 11 Feb 2004, Bram Mertens wrote: > Hi > > I would like to use the following script to start evolution from now on > so the output would be logged. > > Can I replace the "/data/logs/evolution.log" with a variable? Right now > it looks quite ugly and reusing the script for other apps would involve > too much typing/a high risk of typos/not enough laziness :) > > --- script --- > #!/bin/bash > > echo "" >> /data/logs/evolution.log > echo "--- $(date +"%R %A, %B %-d, %Y") ---" >> /data/logs/evolution.log > evolution >> /data/logs/evolution.log 2>&1 > --- end --- > Can I replace it with something like: > --- script --- > #!/bin/bash > > logfile="/data/logs/evolution.log" > > echo "" >> $logfile > echo "--- $(date +"%R %A, %B %-d, %Y") ---" >> $logfile > evolution >> $logfile 2>&1 > --- end --- |
From: Bram M. <bra...@li...> - 2004-02-11 14:37:16
|
Hi I would like to use the following script to start evolution from now on so the output would be logged. Can I replace the "/data/logs/evolution.log" with a variable? Right now it looks quite ugly and reusing the script for other apps would involve too much typing/a high risk of typos/not enough laziness :) --- script --- #!/bin/bash echo "" >> /data/logs/evolution.log echo "--- $(date +"%R %A, %B %-d, %Y") ---" >> /data/logs/evolution.log evolution >> /data/logs/evolution.log 2>&1 --- end --- Can I replace it with something like: --- script --- #!/bin/bash logfile="/data/logs/evolution.log" echo "" >> $logfile echo "--- $(date +"%R %A, %B %-d, %Y") ---" >> $logfile evolution >> $logfile 2>&1 --- end --- TIA -- # Mertens Bram "M8ram" <bra...@li...> Linux User #249103 # # SuSE 8.2 Pro kernel 2.4.20-4GB i686 128MB RAM # # 3:30pm up 19 days 19:08, 6 users, load average: 0.37, 0.27, 0.12 # |
From: Bram M. <bra...@li...> - 2003-03-30 18:39:02
|
On Fri, 2003-03-28 at 21:05, William Shotts wrote: > In bash, the correct format would be: > > printf "# %-65s #\n" "$current_uptime" > > Don't use the parens. Also, you need to quote the argument since it > contains embedded spaces. Lastly, you should include the "\n" in the > format string since there is no carriage return if you don't explicitly > specify it. Thanks! Here's the script with some more changes: #!/bin/bash current_uptime=$(uptime) current_kernel=$(uname -r) current_machine=$(uname -m) current_release="SuSE 8.1 Pro" mem="128MB" NAME="Mertens Bram \"M8ram\"" EMAIL=$1 LINUXID="Linux User #249103" printf "<pre>-- \n" printf "# %-22s %-29s %22s #\n" "$NAME" "$EMAIL" "$LINUXID" printf "# %-16s kernel %-15s %-6s %18s RAM #\n" "$current_release" "$current_kernel" "$current_machine" "$mem" printf "#%70s #\n" "$current_uptime" printf "</pre>\n" I have two other shell scripts that call this script to provide the correct e-mail address, they only contain a single line like: sig-general "<bra...@li...>" Where sig-general is the name of the above script. The reason I need this is because Evolution (my MUA) can call scripts to generate sigs but it can't pass arguments to those scripts (yet). You can see the result below, thanks again for the help! Regards -- # Mertens Bram "M8ram" <bra...@li...> Linux User #249103 # # SuSE 8.1 Pro kernel 2.4.19-4GB i686 128MB RAM # # 10:53am up 11 days, 16:15, 6 users, load average: 2.19, 2.10, 2.05 # |
From: William S. <bs...@pa...> - 2003-03-28 20:05:18
|
In bash, the correct format would be: printf "# %-65s #\n" "$current_uptime" Don't use the parens. Also, you need to quote the argument since it contains embedded spaces. Lastly, you should include the "\n" in the format string since there is no carriage return if you don't explicitly specify it. ||||| William Shotts, Jr. (bshotts AT panix DOT com) ||||| Be a Linux Commander! Follow me to http://linuxcommand.org On Fri, 28 Mar 2003, Bram Mertens wrote: > On Sun, 2003-02-16 at 03:30, William Shotts wrote: > > Bram Mertens wrote: > [snip] > > > ---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--- > [snip] > > bash contains a printf command that is mostly like the C/perl/etc > > function. Try "help printf" at the bash prompt. Failing that, many > > distributions have a printf program that can be called from scripts. > > Try "man printf" > > I can't seem to get this working, I've tried several variations of the > following but A always get the same error: > m8ram@linux:~> sig-general > # SuSE 8.1 Pro kernel 2.4.19-4GB i686 128MB RAM # > # 7:59pm up 11 days, 1:21, 6 users, load average: 2.18, 2.13, 2.10 # > /home/m8ram/bin/sig-general: line 9: syntax error near unexpected token > `"# %-65s #",' > /home/m8ram/bin/sig-general: line 9: `printf("# %-65s #", > curent_uptime)' > > I've tried to specify the variable as $current_uptime, > $(surrent_uptime), ($current_uptime),... > I've tried %c and %s, single quotes, double quotes... > > What is the right format? > > TIA > -- > # Mertens Bram "M8ram" <bra...@li...> Linux User #249103 # > # SuSE 8.1 Pro kernel 2.4.19-4GB i686 128MB RAM # > # 8:01pm up 11 days, 1:23, 6 users, load average: 2.59, 2.22, 2.13 # > > > > ------------------------------------------------------- > This SF.net email is sponsored by: > The Definitive IT and Networking Event. Be There! > NetWorld+Interop Las Vegas 2003 -- Register today! > http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en > _______________________________________________ > Linuxcommand-discuss mailing list > Lin...@li... > https://lists.sourceforge.net/lists/listinfo/linuxcommand-discuss > |
From: Bram M. <bra...@li...> - 2003-03-28 19:10:00
|
On Sun, 2003-02-16 at 03:30, William Shotts wrote: > Bram Mertens wrote: [snip] > > ---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--- [snip] > bash contains a printf command that is mostly like the C/perl/etc > function. Try "help printf" at the bash prompt. Failing that, many > distributions have a printf program that can be called from scripts. > Try "man printf" I can't seem to get this working, I've tried several variations of the following but A always get the same error: m8ram@linux:~> sig-general # SuSE 8.1 Pro kernel 2.4.19-4GB i686 128MB RAM # # 7:59pm up 11 days, 1:21, 6 users, load average: 2.18, 2.13, 2.10 # /home/m8ram/bin/sig-general: line 9: syntax error near unexpected token `"# %-65s #",' /home/m8ram/bin/sig-general: line 9: `printf("# %-65s #", curent_uptime)' I've tried to specify the variable as $current_uptime, $(surrent_uptime), ($current_uptime),... I've tried %c and %s, single quotes, double quotes... What is the right format? TIA -- # Mertens Bram "M8ram" <bra...@li...> Linux User #249103 # # SuSE 8.1 Pro kernel 2.4.19-4GB i686 128MB RAM # # 8:01pm up 11 days, 1:23, 6 users, load average: 2.59, 2.22, 2.13 # |
From: William S. <bs...@pa...> - 2003-02-16 02:31:14
|
Bram Mertens wrote: > 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 bash contains a printf command that is mostly like the C/perl/etc function. Try "help printf" at the bash prompt. Failing that, many distributions have a printf program that can be called from scripts. Try "man printf" -- ||||| William Shotts, Jr. (bshotts AT panix DOT com) ||||| Be a Linux Commander! Follow me to http://linuxcommand.org |