19 September 2005

adric: books icon (c) 2004 adric.net (Default)
As in it's driving me mad, not like we're having a sale or anything...
How do you set an environment variable's value to the output of a command?
It seems like this would work, but it doesn't:
set LIST=`ls | grep -v dump`
Nor does this, even though the Advanced Bash Scripting Guide suggests it here in lesson 12-15:
output=$(sed -n /"$1"/p $file) # Command substitution.

My code snippet:

#!/bin/bash

#get date
set DATE = $(date +%b%d%Y)

#get repo list
set REPOS = $(ls | grep -v dump)

echo date: $DATE repos list: $REPOS

gives:
date: repos list:

Profile

adric: books icon (c) 2004 adric.net (Default)
adric

June 2025

S M T W T F S
1234567
891011121314
15161718192021
22232425262728
2930     

Links

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated 13 July 2025 11:44 am
Powered by Dreamwidth Studios