Gabriel Horner > Fry-Shell-0.08 > handyshell.pl

Download:
Fry-Shell-0.08.tar.gz

Annotate this POD

CPAN RT

New  1
Open  0
View Bugs
Report a bug
Source   Latest Release: Fry-Shell-0.09

NAME ^

handyshell.pl - A handy shell which number aliases filenames

DESCRIPTION ^

This script demonstrates the parse_menu mode of Fry::Shell. The parse_menu mode associates a number with the previous command's output and converts the given numbers

Try it ^

        1. Assuming that you're in a *nix environment, execute handyshell.pl to enter
                the shell.
        2. Type 'ls' (and Enter).  You should see the results of 'ls'. Since
                you didn't specify any of the predefined commands, the shell defaulted to
                executing &loop_default. This script redefines &loop_default by passing any
                commmand as a system call. Hence, typing 'ls' executes as in any regular shell.
        3. Type '\lc' or 'list_commands' to see a list of available commands and their aliases. 
        4. Perhaps you're unsure of how to use &print_global_data. You can type 'h print_global_data' or 'help_usage
        print_global_data' to get a usage regular expression on that command.
        5. Type '-m e ls'. You should see a numbered output of 'ls' with one file per row. This numbered list is a menu 
                of files. You can now execute a command on these files by number.

                        The '-m' is a flag telling the shell to associate the output of this command with numbers for
                        the next command cycle. The 'e' is an alias for 'execute'. &execute does two main
                        things: it correctly numbers the output and saves the output to the
                        &lines accessor.
        6. Now, the cool part. Type 'ls' followed by a list of numbers to act on
                (ie ls 1-3,6). Use a comma to delimit the list and a '-' to specify a range of
                numbers.  You should have listed only the specified files.

Uses ^

        This parsing mode is handy for dealing with a group of files that have a few exceptions. Yes, you can
        deal with these exceptions via regular expressions and auto-completion but
        not always painlessly for your fingers.
        Some uses I've put this handyshell to are:
                deleting several files from a directory (I do this when weeding out new mp3s)
                moving around several files (on new mp3s of course)
                using 'find' or 'slocate' to create the menu and then scp over files

AUTHOR ^

Me. Gabriel that is. If you want to bug me with a bug: cldwalker@chwhat.com If you like using perl,linux,vim and databases to make your life easier (not lazier ;) check out my website at www.chwhat.com.

LICENSE ^

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.