Как установить переменную среды оболочки из файла autotools .am?

Метод 1: tbl

# Предполагается, что GNU sed. Sed генерирует команды tbl на лету, а затем запускается tbl для генерации желаемого результата.

sed -e '
   1i\
.TS\
tab( );

   1{
      h;s/(\s\+)/(,)/g;
      s/\s\+$//;s/^\s\+//;s/\s\+/ /g;
      s/\S\+//g
      s/$/ /;s/ /l&/g;s/.$/./
      G;b
   }
   s/(\s\+)/(,)/g
   $a\
.TE
' | tbl - | nroff -Tascii -ms | sed '/./!d; s/(,)/( )/g'

Объяснение

Actually the sed portion is needlessly complex in our case. I wrote to make it
not being dependent upon how many columns are there in the data & looking at the
data in hand come up with the tbl syntax. Since in our case we are sure there are
exactly 7 columns so the sed code could have been simply be written simply':
(which is what the sed logic actually was generating essentially,
 those 7  space separated ells and a trailing dot)

sed -e '
   1i\
.TS\
tab( );\
l l l l l l l.
   s/(\s\+)/(,)/g
   $a\
.TE
'

The essential boilerplate of the tbl boils down to the following:
a) Mandatory .TS for the start of table
b) data delimiters using    tab(delim_char);
c) columnar publishing: l -> left-justified, r-> right justified,
    c->center-justified, & n-numeric col. Their number must match
    the data cols.
e) Mandatory .TE for the end of table

f) pass on the o/p of tbl to nroff and that's all there's to this utility.

Метод 2: Perl

Этот метод определяет максимальную ширину каждого поля, а затем, используя эту информацию, динамически генерирует спецификатор формата printf. Этот метод даст самый короткий интервал.

perl -lne '
   tr/\t/ /;
   s/\((\s+)\)/"(" . "+" x length($1) . ")"/eg;
   ($a, @F) = (-1, split);
   s/\((\++)\)/"(" . " " x length($1) . ")"/eg for @F;
   push @A, [@F];
   $a++, length > $maxW[$a] and $maxW[$a] = length for @F;
   END {
      my $fmt = join $", map { "%-${_}s" } @maxW;
      print sprintf $fmt, @$_ for @A;
   }
' temp.txt
1
23.06.2017, 03:40
1 ответ

Для объявления переменных окружения лучше использовать файл configure.ac. Там вы можете написать:

export PYTHONHTTPSVERIFY=0

Однако я не уверен, чего вы пытаетесь добиться этим. Нужна ли вам переменная окружения для запуска вашей программы или ее компиляции? В первом случае предпочтительны другие методы.

1
27.01.2020, 23:45

Теги

Похожие вопросы