bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

shopt suggestion


From: Nellis, Kenneth
Subject: shopt suggestion
Date: Thu, 31 Aug 2017 14:43:05 +0000

Frequently, when I invoke a command and use globbing to specify a list 
of files, I want a temporary change in globbing options 
(e.g. shopt -s dotglob) to be in effect for the one-time command.

At the keyboard, it is inconvenient to type (e.g.): 
shopt -s dotglob; mycmd; shopt -u dotglob

I could write a wrapper function/script to minimize the typing: 
tempglob dotglob 'mycmd'
but I'd still have to escape mycmd so that globbing would be expanded 
only within the function/script.

But, I wonder if shopt might not itself accept a command to execute 
with one-time shopt options in effect. It could follow the precedent 
of the env command or the shell's feature to execute a command with 
a temporary environment variable setting, e.g.: VAR=VALUE mycmd
Then we could have something like: shopt -s dotglob -c mycmd

--Ken Nellis



reply via email to

[Prev in Thread] Current Thread [Next in Thread]