Commit 8af3babf authored by Vitali Tatarintev's avatar Vitali Tatarintev

Merge branch 'ImproveShellScriptsVariable' into 'master'

Declare and assign variable separately in Shell Script

See merge request gitlab-org/gitlab!46121
parents 2e9af7dc 13976cda
...@@ -9,7 +9,8 @@ mail_room_config="$app_root/config/mail_room.yml" ...@@ -9,7 +9,8 @@ mail_room_config="$app_root/config/mail_room.yml"
get_mail_room_pid() get_mail_room_pid()
{ {
local pid=$(cat $mail_room_pidfile) local pid
pid=$(cat $mail_room_pidfile)
if [ -z "$pid" ] ; then if [ -z "$pid" ] ; then
echo "Could not find a PID in $mail_room_pidfile" echo "Could not find a PID in $mail_room_pidfile"
exit 1 exit 1
......
...@@ -9,7 +9,8 @@ unicorn_cmd="bundle exec unicorn_rails -c $unicorn_config -E $RAILS_ENV" ...@@ -9,7 +9,8 @@ unicorn_cmd="bundle exec unicorn_rails -c $unicorn_config -E $RAILS_ENV"
get_unicorn_pid() get_unicorn_pid()
{ {
local pid=$(cat $unicorn_pidfile) local pid
pid=$(cat $unicorn_pidfile)
if [ -z "$pid" ] ; then if [ -z "$pid" ] ; then
echo "Could not find a PID in $unicorn_pidfile" echo "Could not find a PID in $unicorn_pidfile"
exit 1 exit 1
......
---
title: Declare and assign variable separately in Shell Script
merge_request: 46121
author: Peter Dave Hello @PeterDaveHello
type: other
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment