Search code examples
ruby-on-railscapistrano

capistrano output - what are [ -L ...] commands?


I have a rails 4 app deployed with capistrano. In my output there are a bunch of commands running that I do not understand at all. I'm trying to figure out why some of them fail, but the real problem is I don't know what they are doing at all.

Here is a typical example:

DEBUG [8020adb4] Running /usr/bin/env [ -L ~/apps/spo/releases/20160205133156/public/assets ] as [email protected]
DEBUG [8020adb4] Command: [ -L ~/apps/spo/releases/20160205133156/public/assets ]
DEBUG [8020adb4] Finished in 0.013 seconds with exit status 1 (failed).

I know that /usr/bin/env will run a program, but I have no idea what this part is trying to do: [ -L ~apps/spo/releases/20160205133156/public/assets ]

Something like this: /usr/bin/env mkdir is easy to understand, it is running mkdir.

If anyone can explain what these [ -L ...] commands are doing I would greatly appreciate it!


Solution

  • The square brackets are an alternative syntax for the test command.

    Which test is run depends on the expression you give, in this case it checks whether ~/apps/spo/releases/20160205133156/public/assets exists and is a symbolic link.

    From man test:

     -L FILE
                  FILE exists and is a symbolic link (same as -h)