~/ 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/cb85968f-c290-4766-ae0f-66e7d1bb723c/flashcard utf-8 LF