Groups | Search | Server Info | Login | Register
Groups > alt.comp.lang.shell.unix.bourne-bash > #297
| From | Lewis <g.kreme@kreme.dont-email.me> |
|---|---|
| Newsgroups | alt.comp.lang.shell.unix.bourne-bash |
| Subject | Re: Command substitution into argument to convert |
| Date | 2022-06-14 20:26 +0000 |
| Organization | Miskatonic U |
| Message-ID | <slrntahrn9.2ok.g.kreme@m1mini.local> (permalink) |
| References | <t88358$ad1$1@dont-email.me> <slrntafl3g.11f5.g.kreme@zephyrus.local> <t8a0ng$umi$1@dont-email.me> |
In message <t8a0ng$umi$1@dont-email.me> Michael F. Stemper <michael.stemper@gmail.com> wrote: > On 13/06/2022 19.21, Lewis wrote: >> In message <t88358$ad1$1@dont-email.me> Michael F. Stemper <michael.stemper@gmail.com> wrote: >>> I'm trying to time-stamp image files as they're downloaded. The >>> following works fine: >> >>> $ convert -pointsize 20 -fill black -draw 'text 10,20 "06/13 14:13"' RadarMap.png Stamped.png >> >>> However, hard-coding the time stamp would make it worthless. What >>> I really want to use is the output of: >> >>> $ date +"%m/%d %H:%M" >> >> So do that. >> >> $ MYDATE=$(date +"%m/%d %H:%M");convert -pointsize 20 -fill black -draw 'text 10,20 "$MYDATE"' RadarMap.png Stamped.png > No error message is given. The text drawn on the image is: > $MYDATE Then it is still a quoting issue, probably beaus you hav single quotes around the outside. I do not use the convert tool, so I can’t tell you specifically what the issue is, but the first thing I wold do is eliminate the single quotes, assuming they are not required by convert. $ MYDATE=$(date +"%m/%d %H:%M");convert -pointsize 20 -fill black -draw "text 10,20 $MYDATE" RadarMap.png Stamped.png or maybe $ MYDATE=$(date +"%m/%d %H:%M");convert -pointsize 20 -fill black -draw "text 10,20 \"$MYDATE\"" RadarMap.png Stamped.png Remember that ' and " ae very different, and ' do not usually allow expansion of variables contained inside, but sometimes it is hard to know when a variable is being expanded by the shell and when it is being passed to the command. Either way, sometimes you just have to play with the quotes and the escapes. -- Were it not for frustration and humiliation I suppose the human race would get ideas above its station. -Ogden Nash
Back to alt.comp.lang.shell.unix.bourne-bash | Previous | Next — Previous in thread | Next in thread | Find similar
Command substitution into argument to convert "Michael F. Stemper" <michael.stemper@gmail.com> - 2022-06-13 14:28 -0500
Re: Command substitution into argument to convert "Michael F. Stemper" <michael.stemper@gmail.com> - 2022-06-13 15:29 -0500
Re: Command substitution into argument to convert Grant Taylor <gtaylor@tnetconsulting.net> - 2022-06-13 16:32 -0600
Re: Command substitution into argument to convert Lewis <g.kreme@kreme.dont-email.me> - 2022-06-14 00:21 +0000
Re: Command substitution into argument to convert "Michael F. Stemper" <michael.stemper@gmail.com> - 2022-06-14 07:59 -0500
Re: Command substitution into argument to convert Lewis <g.kreme@kreme.dont-email.me> - 2022-06-14 20:26 +0000
Re: Command substitution into argument to convert Lewis <g.kreme@kreme.dont-email.me> - 2022-06-14 23:38 +0000
Re: Command substitution into argument to convert "Michael F. Stemper" <michael.stemper@gmail.com> - 2022-06-15 07:55 -0500
csiph-web