Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Utilities

    printargs 0.0.0-20071004-014647

    Download button

    No screenshots available
    Downloads: 391  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    Fair (2.5/5)
    4 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Valentin Hilbig | More programs
    GPL / FREE
    October 16th, 2007, 15:39 GMT
    ROOT / Utilities

     Read user reviews (0)  Refer to a friend  Subscribe

    printargs description

    printargs does for command line arguments what printenv does for the environment.

    printargs project does for command line arguments what printenv does for the environment. The output is bash friendly such that you can assemble the arguments to stdout in a way that bash can parse them on shell level without additional help.

    This works even for meta-characters or line feeds in arguments. The code also is optimized to compile into a small static executable.

    Actually, it does print a little bit more than just args and was designed for easy shell usage for argument manipulation and transmitting.

    The output can be parsed by bourne shells again and is splitted onto stdout and stderr, such that you can use following code to save the arguments into a single line:

    < pre >
    saveargs="`printargs args... 2>/dev/null`"
    ...
    eval cmd $saveargs
    < /pre >

    The full output can be parsed as follows. However you must be prepared that future versions may add more information right before the arg0 line:

    < pre >
    printargs args... 2>&1 |
    while read -r what arg
    do
    eval data="$arg"
    ...
    done
    < /pre >

    Note that printargs prints linefeeds to stderr and not stdout. This behavior is intentional to be able to concatenate argument lists on stdout from a loop.

    Also note that printargs does not pad arguments with blanks at the beginning nor at the end, so you have to add these blanks yourself.

    In args chars $, ' and blanks are escaped such that you can easily remove those ANSI sequence characters with '| tr -d "' $"'. This feature is intentional with a little readability tradeoff.

    Product's homepage

      


    TAGS:

    static executables | parse arguments | stdout parser | printenv | stdout | argument

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM