Joe Pfeiffer writes: > The underlying problem is that umask isn't a standalone command, it's a > shell builtin. So if you look at the bash manpage you can find the > (very terse) documention; of course, there's no hint anywhere that you > should do that. Just as for (looking at some other builtins) ulimit, > unalias, unset....
It seems to me a simple Perl script might do the trick here? For example, imagine a script called 'dhelp': --- BEGIN --- #!/usr/bin/perl use strict; use warnings; use Term::ReadKey; my $shell = $ENV{'SHELL'}; my $cmd = $ARGV[0]; open(my $fh, '-|', "$shell -c 'type $cmd'") or die "Couldn't start $shell: $!"; while (<$fh>) { if (/builtin/) { print "$cmd is a $shell builtin; press any key for $shell man page ....\n"; ReadMode 'cbreak'; my $key = ReadKey(0); ReadMode 'normal'; system('man', $shell); } elsif (/alias/) { print "$_\n"; } elsif (/\//) { system('man', $cmd); } } --- END --- Then the user could type e.g.: $ dhelp umask and get told it's a builtin before being sent to the shell man page, or could type: $ dhelp whoami and be sent straight to the man page for whoami(1). Obviously the above needs to proper input and error handling, and handling of the different forms the output of 'type' can take in different shells, but wouldn't something like the above be easiest for maintainers, and useful for end-users? Alexis. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/874mugvp3y....@gmail.com