Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shar: error detected for no files processed #475

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions bin/shar
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ sub usage {
}

getopts('') or usage();
@ARGV or usage();
binmode STDOUT;

my $dirty = 0;
ARGUMENT: for my $f ( @ARGV ) {
unless ($dirty) {
print '# --cut here--
print '# --cut here--
# To extract, remove everything before the "cut here" line
# and run the command "sh file".
';
$dirty = 1;
}

my $done = 0;
ARGUMENT: for my $f ( @ARGV ) {
if (-d $f) {
print "echo x - $f/\n";
print "mkdir -p $f\n";
$done++;
next ARGUMENT;
}
unless (open FH, '<', $f) {
Expand All @@ -68,9 +68,9 @@ ARGUMENT: for my $f ( @ARGV ) {
}
print "FUNKY_STUFF\n";
close(FH);
$done++;
}

unless ($dirty) {
if ($done == 0) {
warn "$Program: no input files were processed\n";
exit EX_FAILURE;
}
Expand Down
Loading