Hacker News new | past | comments | ask | show | jobs | submit login

Not that this is an important part of the post, but in general parsing the output of ls like the author does in the for loop is a bad idea[1].

I think the one-liner would be better as

  for i in [0-8]*/*.sql; do psql -U <user> -h localhost -d <dbname> -f $i ; done
or even better as something like

  find . -name "*.sql" -exec psql -U <user> -h localhost -d <dbname> -f {} \;
[1] http://mywiki.wooledge.org/ParsingLs



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: