1. lets say to set environmental variable I have:
PAGER=less ./tinybase -r <<'EOF'
x
y
z
EOF
2. now lets say to set environmental variable I have:
PAGER=less
./tinybase -r <<'EOF'
x
y
z
EOF
Case 1 always works while case 2 fails.
Does this mean, as it appears, PAGER *must* be on the same line (inline)?
[...]
HTH
On Sat, 8 Nov 2025 15:36:10 -0000 (UTC), Lew Pitcher wrote:
[...]
HTH
Yes sir it very much does.
Added your reply to my notes, thank you.
In article <10eno7c$2llvn$1@dont-email.me>,
Michael Sanders <porkchop@invalid.foo> wrote:
On Sat, 8 Nov 2025 15:36:10 -0000 (UTC), Lew Pitcher wrote:
[...]
HTH
Yes sir it very much does.
Added your reply to my notes, thank you.
To amplify a bit on Lew's excellent response.
I am assuming you are using bash. I don't care about being quote-unquote "portable" to ancient shells. I neither know nor care if or what parts of what I write are not quote-unquote "portable".
1) As Lew noted, you can either do:
$ PAGER=less
$ export PAGER
or, equivalently:
$ export PAGER=less
And, in particular for this specific variable, one of the above (preferably the later) is usually done "globally" - that is, in .profile (or similar).
It is rare that you'd want to set it only for one particular program (e.g., your tinybase program).
2) Generally, you only export what needs to be exported. So, sometimes you find that you need a non-exported variable to be exported just for the run
of a particular program or command. In that case, I frequently do
something like:
$ REPLY="$REPLY" someCommand
(REPLY is a frequently used variable that is usually *not* exported)
1. lets say to set environmental variable I have:
PAGER=less ./tinybase -r <<'EOF'
x
y
z
EOF
2. now lets say to set environmental variable I have:
PAGER=less
./tinybase -r <<'EOF'
On 2025-11-08, Michael Sanders <porkchop@invalid.foo> wrote:
1. lets say to set environmental variable I have:
PAGER=less ./tinybase -r <<'EOF'
x
y
z
EOF
2. now lets say to set environmental variable I have:
PAGER=less
./tinybase -r <<'EOF'
You need a backslash:
PAGER=less \
./rest-of-command ...
Otherwise you have two commands: a variable assignment followed by a
command, and not "run the program with this environment variable".
It will still work if you have a PAGER variable that is exported
to the environment.
I don't. This is a vanilla Ubuntu environment and I didn't go out
of my way to remove it:
$ env | grep PAGER
MANPAGER=/home/kaz/bin/mnpgr
You need a backslash:
PAGER=less \
./rest-of-command ...
That backslash is a good point Kaz.
That backslash is a good point Kaz.
Not really. I think he's just messin' with ya.
Putting the backslash there is just another way of putting it all on the
same line.
1. lets say to set environmental variable I have:
PAGER=less ./tinybase -r <<'EOF'
...
2. now lets say to set environmental variable I have:
PAGER=less
./tinybase -r <<'EOF'
...
Case 1 always works while case 2 fails.
Remember that, in Bash and other similar shells, environment variables and shell variables are mostly the same thing (they share the same namespace),
On Sat, 8 Nov 2025 15:04:53 -0000 (UTC), Michael Sanders wrote:
Then there is this additional construct where, if you say something like
A=1 -2cmd-+
then this defines a new environment variable A with the given value, that
is only seen by the process spawned by -2cmd-+. If A already has a value within the current shell context, that definition is unchanged.
2025-11-08 21:54 ldo@nz.invalid:
On Sat, 8 Nov 2025 15:04:53 -0000 (UTC), Michael Sanders wrote:
Then there is this additional construct where, if you say something like
A=1 -2cmd-+
then this defines a new environment variable A with the given value, that >> is only seen by the process spawned by -2cmd-+. If A already has a value
within the current shell context, that definition is unchanged.
What happens if we put a semicolon in there?
A=1; -2cmd-+
2025-11-08 21:54 ldo@nz.invalid:
On Sat, 8 Nov 2025 15:04:53 -0000 (UTC), Michael Sanders wrote:
Then there is this additional construct where, if you say something like
A=1 -2cmd-+
then this defines a new environment variable A with the given value, that >> is only seen by the process spawned by -2cmd-+. If A already has a value
within the current shell context, that definition is unchanged.
What happens if we put a semicolon in there?
A=1; -2cmd-+
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 54 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 19:20:29 |
| Calls: | 742 |
| Files: | 1,218 |
| D/L today: |
5 files (8,203K bytes) |
| Messages: | 184,913 |
| Posted today: | 1 |