~/ learn/ comp-325/ cards/ Python 3 when the script outgrows the shell
1 of 11

The Bourne original — a directory check over the arguments

The Bourne original — a directory check over the arguments

Answer

#!/bin/sh for d in "$@" do if [ -d "$d" ]; then echo "$d: directory" fi done

Six lines, three of which are punctuation the shell needs, and every expansion has to be quoted or a filename with a space breaks it. This is the script the next lesson block rewrites.

Python 3 documentation: sys, os.path, os, subprocess (docs.python.org/3)

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/d4485004-55d1-4844-9be6-363f4c781bbc/flashcard utf-8 LF