1

I want to run a for loop, is there a way to do a nullglob in the korn shell like in other shells?

for file in docs*.txt; do
Roland
  • 163
  • 1
    Relating https://unix.stackexchange.com/a/16956/117549 and https://unix.stackexchange.com/a/184133/117549 – Jeff Schaller May 08 '20 at 13:39
  • 1
    Yes, as seen in the answers to the questions marked as duplicates. Prefix the pattern with ~(N). – Kusalananda May 08 '20 at 13:43
  • I don't have a timeline for what versions of ksh that's true for, but is the right direction. – Jeff Schaller May 08 '20 at 13:43
  • 1
    @JeffSchaller When ksh is mentioned without any other qualifier, I'm assuming ksh93. – Kusalananda May 08 '20 at 13:44
  • @Kusalananda No, it's ksh 83 – Roland May 08 '20 at 14:06
  • 1
    83? Do you mean 88? On what Unix? – Kusalananda May 08 '20 at 14:38
  • @Kusalananda my colleague told me it's Linux. But I suspect he is wrong. I will recheck that – Roland May 08 '20 at 14:41
  • 1
    @Roland Do consider updating your question with the type of Unix you're using, the version of ksh that is in use, and whether ~(N)docs*.txt works as you want it to or not. Unfortunately there are a number of various ksh shells (ksh88, ksh93, pdksh and mksh), and they work slightly differently compared to each other. – Kusalananda May 08 '20 at 14:48
  • @Roland see https://unix.stackexchange.com/questions/199900/how-can-i-safely-get-the-version-of-ksh for help in determining the ksh version. – Jeff Schaller May 08 '20 at 18:35

0 Answers0