mirror of
https://github.com/dcarrillo/prezto.git
synced 2024-12-22 12:48:01 +00:00
Localize variables, improve readability
This commit is contained in:
parent
325a377d5e
commit
9bf1789cc2
@ -6,11 +6,21 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
print '#!/bin/sh'"\n" > apt-copy.sh
|
||||
local clone_script="${0}.sh"
|
||||
local package_list=$(
|
||||
perl \
|
||||
-m 'AptPkg::Cache' \
|
||||
-e '
|
||||
$c=AptPkg::Cache->new;
|
||||
for (keys %$c) {
|
||||
push @a, $_ if $c->{$_}->{'CurrentState'} eq 'Installed';
|
||||
}
|
||||
print "$_ " for sort @a;
|
||||
'
|
||||
)
|
||||
|
||||
list=$(perl -m'AptPkg::Cache' -e '$c=AptPkg::Cache->new; for (keys %$c){ push @a, $_ if $c->{$_}->{'CurrentState'} eq 'Installed';} print "$_ " for sort @a;')
|
||||
|
||||
print 'aptitude install '"$list\n" >> apt-copy.sh
|
||||
|
||||
chmod +x apt-copy.sh
|
||||
rm "$clone_script"
|
||||
print '#!/bin/sh\n' > "$clone_script"
|
||||
print "aptitude install ${package_list}\n" >> "$clone_script"
|
||||
chmod +x "$clone_script"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user