Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #158098 > unrolled thread

Re: bash script globbing

Started byLoïc Grenié <loic.grenie@gmail.com>
First post2015-09-20 22:30 +0200
Last post2015-09-20 23:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.debian.user

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: bash script globbing Loïc Grenié <loic.grenie@gmail.com> - 2015-09-20 22:30 +0200
    Re: bash script globbing rlharris@oplink.net - 2015-09-20 23:30 +0200

#158098 — Re: bash script globbing

FromLoïc Grenié <loic.grenie@gmail.com>
Date2015-09-20 22:30 +0200
SubjectRe: bash script globbing
Message-ID<qaTpg-1Zo-3@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

2015-09-20 22:20 GMT+02:00 <rlharris@oplink.net>:

> I have been using the following script (named "enscript+") as a substitute
> for the package "a2ps":
>
>     #!/bin/bash
>     enscript --media=letter -2 --landscape --borders \
>     --header='$n|A.D. $D{%Y.%m.%d}|$* gmt | Page $% of $=' "$1"
>

    Here "$1" means "for the first argument"
   If enscript can work with several files together, you cn substitue "$1"
simply
  by "$@"
  If however enscript can only work one file at a time, you can do the
following:

for f in "$@"
do
  <same enscript line substituting "$f" for "$1">
done

     Hope this helps.

          Loïc


> The script works properly for a single file:
>
>     enscript+ filename
>
> But when I execute
>
>     enscript+ *
>
> in a directory containing several files, enscript prints only the first
> file in the directory.
>
> I googled "bash script globbing", but the discussions which I found are
> deep and confusing.  Is there not a simple solution?
>
> RLH
>
>
>

[toc] | [next] | [standalone]


#158102

Fromrlharris@oplink.net
Date2015-09-20 23:30 +0200
Message-ID<qaUlk-3lF-5@gated-at.bofh.it>
In reply to#158098
On Sun, September 20, 2015 3:28 pm, Loïc Grenié wrote:
...
>> #!/bin/bash
>> enscript --media=letter -2 --landscape --borders \ --header='$n|A.D.
>> $D{%Y.%m.%d}|$* gmt | Page $% of $=' "$1"
...
> Here "$1" means "for the first argument"
> If enscript can work with several files together, you cn substitue "$1"
> simply by "$@" If however enscript can only work one file at a time,...

Thanks.  A week or so ago I asked for help, because enscript was not
seeing changes which I made to the configuration file in order to change
the margins and customize headings; that I why I ended up putting the
customization into a bash script "enscript+".

However, just now, when I executed "enscript *" on a directory of files,
to see whether the unmodified package could handle globs, all of the files
printed properly, together with the customized headers!  So now I am
confused, but at least I am able to use the glob "*" and have the headers
and margins which I desired.

Thanks.

RLH

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web