× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



To check if you use the ls cmd in the same path you may use: qsh cmd('which ls')
If it's in a different path you may check your environment: qsh cmd('set')

Changing the environment is done in a .profile file you may find it on user level (qsh cmd('ls ~/.prof*')) or system wide level (qsh cmd('ls /QOpensys/etc/profile'))
https://www-01.ibm.com/support/docview.wss?uid=nas8N1010486 (-> Portable Application Solutions Environment (PASE) - Envrionment Setup Using /QOpenSys/etc/profile and $HOME/.profile) may give you more details on this.

regards

Markus

-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Scott Klement
Sent: Samstag, 16. April 2022 00:57
To: midrange-l@xxxxxxxxxxxxxxxxxx
Subject: Re: qsh stdout difference per IBM i

Hi Jay,

I was thinking along the same lines as Jack... you've probably got a different version of 'ls' in your PATH or something.

I also notice that your 2nd example includes the full path vs. just the file name, which also seems to indicate you are picking up a different version of ls.

The default mode in 'ls' is actually to print multiple files per line.
If you want just one per line, most 'ls' utilities have a -1 (that's the number 1) switch that can be passed that means "one per line".

So try it like this:

qsh cmd('cd /home/jvaughn/.ssh && ls -1A')

Since it's listing the current directory, it's less likely to give you the paths. And the -1 explicitly tells it to only include one per line.
(-1A is -1=one per line, and -A=include hidden files.)

Also, FWIW, I don't recommend using OVRDBF FILE(STDOUT) in a production program. It's fine for a one-off or just messing around, but... if it's a "real" program, consider piping the output to Rfile to write it to a PF, or use a redirect to write it to a stream file.

-SK


On 4/15/2022 1:55 PM, Jay Vaughn wrote:
I'm trying to figure out why 2 different IBM i's produce different
stdout outputs...

system1
OVRDBF FILE(STDOUT) TOFILE(QTEMP/DIRLIST)
OVRSCOPE(*JOB)
OPNSCOPE(*JOB)

qsh cmd('ls -A /home/jvaughn/.ssh')

SRCSEQ SRCDAT SRCDTA
.00 0 xyz_rsa_prv
.00 0 xyz_rsa_pub
.00 0 abc_rsa_prv
.00 0 abc_S_rsa_pub
******** End of data ********

output nicely per row in qtemp/dirlist

system 2
same steps above but...

SRCSEQ SRCDAT SRCDTA

.00 0 /home/jvaughn/.ssh/STOREPORT_rsa_pub
/home/jvaughn/.ssh/i
.00 0 /home/jvaughn/.ssh/id_rsa
/home/jvaughn/.ssh/known_h
******** End of data ********

2 files per row instead of 1...

tia

Jay
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://urldefense.com/v3/__https://lists.midrange.com/mailman/listinfo/midrange-l__;!!CqVFughQ-RE!x4Fc0HZ-Y55JwcZkmfu52edR5M4nLxE3KZtna7vAwRNqpCGiYTPmuard1-S6v5A7gCLl$
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://urldefense.com/v3/__https://archive.midrange.com/midrange-l__;!!CqVFughQ-RE!x4Fc0HZ-Y55JwcZkmfu52edR5M4nLxE3KZtna7vAwRNqpCGiYTPmuard1-S6v-qEyhSY$ .

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://urldefense.com/v3/__https://amazon.midrange.com__;!!CqVFughQ-RE!x4Fc0HZ-Y55JwcZkmfu52edR5M4nLxE3KZtna7vAwRNqpCGiYTPmuard1-S6v6P7MpYx$

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.