Fixed bug #44350: --tagstring should support \t.

This commit is contained in:
Ole Tange 2015-02-24 23:36:32 +01:00
parent 2dee8e452b
commit d19de35acb
3 changed files with 17 additions and 2 deletions

View file

@ -860,7 +860,8 @@ sub parse_options {
if(defined $opt::X) { $Global::ContextReplace = 1; } if(defined $opt::X) { $Global::ContextReplace = 1; }
if(defined $opt::silent) { $Global::verbose = 0; } if(defined $opt::silent) { $Global::verbose = 0; }
if(defined $opt::0) { $/ = "\0"; } if(defined $opt::0) { $/ = "\0"; }
if(defined $opt::d) { my $e="sprintf \"$opt::d\""; $/ = eval $e; } if(defined $opt::d) { my $e="sprintf qq{$opt::d}"; $/ = eval $e; }
if(defined $opt::tagstring) { my $e="sprintf qq{$opt::tagstring}"; $opt::tagstring = eval $e; }
if(defined $opt::p) { $Global::interactive = $opt::p; } if(defined $opt::p) { $Global::interactive = $opt::p; }
if(defined $opt::q) { $Global::quoting = 1; } if(defined $opt::q) { $Global::quoting = 1; }
if(defined $opt::r) { $Global::ignore_empty = 1; } if(defined $opt::r) { $Global::ignore_empty = 1; }
@ -1034,7 +1035,7 @@ sub parse_options {
sub init_globals { sub init_globals {
# Defaults: # Defaults:
$Global::version = 20150224; $Global::version = 20150225;
$Global::progname = 'parallel'; $Global::progname = 'parallel';
$Global::infinity = 2**31; $Global::infinity = 2**31;
$Global::debug = 0; $Global::debug = 0;

View file

@ -119,6 +119,11 @@ echo '### Test --block size=1M -j1 - more data than cpu';
echo '### Test --pipe default settings'; echo '### Test --pipe default settings';
cat /tmp/blocktest | parallel --pipe sort | sort -n | md5sum cat /tmp/blocktest | parallel --pipe sort | sort -n | md5sum
echo '### bug #44350: --tagstring should support \t';
parallel --tagstring 'a\tb' echo ::: c
parallel -d '\t' echo ::: 'a b'
parallel -d '"' echo ::: 'a"b'
EOF EOF
rm /tmp/parallel-seq /tmp/blocktest rm /tmp/parallel-seq /tmp/blocktest

View file

@ -297,3 +297,12 @@ echo '### Test --block size=1M -j1 - more data than cpu'; cat /tmp/blocktest |
echo '### Test --pipe default settings'; cat /tmp/blocktest | parallel --pipe sort | sort -n | md5sum echo '### Test --pipe default settings'; cat /tmp/blocktest | parallel --pipe sort | sort -n | md5sum
### Test --pipe default settings ### Test --pipe default settings
8a7095c1c23bfadc311fe6b16d950582 - 8a7095c1c23bfadc311fe6b16d950582 -
echo '### bug #44350: --tagstring should support \t'; parallel --tagstring 'a\tb' echo ::: c
### bug #44350: --tagstring should support \t
a b c
parallel -d '\t' echo ::: 'a b'
a
b
parallel -d '"' echo ::: 'a"b'
a
b