marconi has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: (OT) Korne Shell Parameter...
by moritz (Cardinal) on Dec 06, 2007 at 10:21 UTC
    Perhaps there is a problem with the Syntax below :-

    Yes, it's not perl ;-)

    #!/usr/bin/perl use strict; use warnings; my $uid = $ARGV[0]; open (my $fh, '<', '/etc/passwd') or die "Can't open passwd file: $!"; while (<$fh>){ my $this_uid = (split m/:/)[2]; print if $this_uid > $uid; } close $fh;
Re: (OT) Korne Shell Parameter...
by parv (Parson) on Dec 06, 2007 at 10:35 UTC

    You should try comp.unix.shell newsgroup for shell, including korn shell (or simply ksh), questions instead of this site related to things Perl.

    In any case ...

    #!/usr/bin/ksh uid=${uid:-/etc/passwd}

    Why not just set $uid directly (uid='/etc/passwd')?

    /etc/passwd/read $ cut-d: -f1 < uid gt $$

    Just what are you trying to do there? Does your script run to completion successfully (not that it gives a result)?

Re: (OT) Korne Shell Parameter...
by sh1tn (Priest) on Dec 06, 2007 at 12:24 UTC
    Command line solution:
    export uid=1000; perl -ne '$1 > $ENV{"uid"} and print if /\w+:\w+:(\d+ +)/' /etc/passwd