0

I need to write a script that will recreate my opt folder if it gets deleted when I remove a package from it. Here's a link to my previous post: dpkg remove to stop processes

Now, the issue I'm running into could be better described here: http://lists.debian.org/debian-devel/2006/03/msg00242.html

I was thinking of just adding a postrem script which checks if an opt directory exists, and if not, creates one. My experience with shell scripts is pretty limited though..

Community
  • 1
  • 1
user1553248
  • 1,184
  • 2
  • 19
  • 33

1 Answers1

1
[ -d "$dir" ] || mkdir -p "$dir"

This could be written more verbosely / clearly as:

if ! test -d "$dir"; then
    mkdir -p "$dir"
fi

See help test for more information.

We Are All Monica
  • 13,000
  • 8
  • 46
  • 72