Skip to main content
deleted 125 characters in body
Source Link
Rui F Ribeiro
  • 58k
  • 28
  • 156
  • 237

I have a BASH scripting question. I'd like the mention that I am new to BASH scripting; however, I am not new to programming. I am developing a simple BASH script to watch a given compass project. My script is shown below.

I would like to allow a user to optionally enter a custom path or use the default http_path value. I'm not sure how to set the path variable equal to the http_path variable where my default Apache directory is located using my current script. If any one has better suggestions and/or resources for learning how to write BASH scripts, please share!

Note: I have searched this site, Google, and stackoverflow for an answer. If you find one with a solution to my issue, please let me know!

#!/bin/bash
# This script will watch a given compass project
http_path=/var/www/

echo -n "Enter in a new path and press. To use the default path $http_path press [ENTER] twice"

while read path; do
    if [ -z "${path}" ]; then
        clear  
        # these two lines enable the script to work if I do not
        # I do not prompt for default path. It's been tested and works
        # echo "That was empty, do it again!"
        # echo -n "Enter in a compass project directory and press [ENTER]"
        echo "Are you sure you would like to use the default path? Press [ENTER] to continue..."
        $path=$http_path
    else
        echo "Checking now..."
        break
    fi
done

echo -n "Enter in a project to watch and prss [ENTER]"

while read project; do
    if [ -z "${project}" ]; then
        clear  
        echo "That was empty, do it again!"
        echo -n "Enter in a compass project name and press [ENTER]"
    else
        echo "Checking now..."
        break
    fi
done

echo "Watching" $project "project in directory" $path
echo "To exit project press Command/Control + C"

cd $path
compass watch $project

See problem solution here

I have a BASH scripting question. I'd like the mention that I am new to BASH scripting; however, I am not new to programming. I am developing a simple BASH script to watch a given compass project. My script is shown below.

I would like to allow a user to optionally enter a custom path or use the default http_path value. I'm not sure how to set the path variable equal to the http_path variable where my default Apache directory is located using my current script. If any one has better suggestions and/or resources for learning how to write BASH scripts, please share!

Note: I have searched this site, Google, and stackoverflow for an answer. If you find one with a solution to my issue, please let me know!

#!/bin/bash
# This script will watch a given compass project
http_path=/var/www/

echo -n "Enter in a new path and press. To use the default path $http_path press [ENTER] twice"

while read path; do
    if [ -z "${path}" ]; then
        clear  
        # these two lines enable the script to work if I do not
        # I do not prompt for default path. It's been tested and works
        # echo "That was empty, do it again!"
        # echo -n "Enter in a compass project directory and press [ENTER]"
        echo "Are you sure you would like to use the default path? Press [ENTER] to continue..."
        $path=$http_path
    else
        echo "Checking now..."
        break
    fi
done

echo -n "Enter in a project to watch and prss [ENTER]"

while read project; do
    if [ -z "${project}" ]; then
        clear  
        echo "That was empty, do it again!"
        echo -n "Enter in a compass project name and press [ENTER]"
    else
        echo "Checking now..."
        break
    fi
done

echo "Watching" $project "project in directory" $path
echo "To exit project press Command/Control + C"

cd $path
compass watch $project

See problem solution here

I am developing a simple BASH script to watch a given compass project. My script is shown below.

I would like to allow a user to optionally enter a custom path or use the default http_path value. I'm not sure how to set the path variable equal to the http_path variable where my default Apache directory is located using my current script. If any one has better suggestions and/or resources for learning how to write BASH scripts, please share!

Note: I have searched this site, Google, and stackoverflow for an answer. If you find one with a solution to my issue, please let me know!

#!/bin/bash
# This script will watch a given compass project
http_path=/var/www/

echo -n "Enter in a new path and press. To use the default path $http_path press [ENTER] twice"

while read path; do
    if [ -z "${path}" ]; then
        clear  
        # these two lines enable the script to work if I do not
        # I do not prompt for default path. It's been tested and works
        # echo "That was empty, do it again!"
        # echo -n "Enter in a compass project directory and press [ENTER]"
        echo "Are you sure you would like to use the default path? Press [ENTER] to continue..."
        $path=$http_path
    else
        echo "Checking now..."
        break
    fi
done

echo -n "Enter in a project to watch and prss [ENTER]"

while read project; do
    if [ -z "${project}" ]; then
        clear  
        echo "That was empty, do it again!"
        echo -n "Enter in a compass project name and press [ENTER]"
    else
        echo "Checking now..."
        break
    fi
done

echo "Watching" $project "project in directory" $path
echo "To exit project press Command/Control + C"

cd $path
compass watch $project

See problem solution here

Issue when settingssetting a default path in BASH

I have a BASH scripting question. I'd like the mention that I am new to BASH scripting; however, I am nownot new to programming. I am developing a simple BASH script to watch a given compass project. My script is shown below.

I would like to allow a user to optionally enter in a custom path or use the default http_path value. I'm not sure how to set the path variable equal to the http_path variable where my default Apache directory is located using my current script. If any one has better suggestions and/or resources for learning how to write BASH scripts, please share!

Note: I have searched this site, googleGoogle, and stackoverflow for an answer. If you find one with a solution to my issue, please let me know!

#!/bin/bash
# This script will watch a given compass project
http_path=/var/www/

echo -n "Enter in a new path and press. To use the default path $http_path press [ENTER] twice"

while read path; do
    if [ -z "${path}" ]; then
        clear  
        # these two lines enable the script to work if I do not
        # I do not prompt for default path. It's been tested and works
        # echo "That was empty, do it again!"
        # echo -n "Enter in a compass project directory and press [ENTER]"
        echo "Are you sure you would like to use the default path? Press [ENTER] to continue..."
        $path=$http_path
    else
        echo "Checking now..."
        break
    fi
done

echo -n "Enter in a project to watch and prss [ENTER]"

while read project; do
    if [ -z "${project}" ]; then
        clear  
        echo "That was empty, do it again!"
        echo -n "Enter in a compass project name and press [ENTER]"
    else
        echo "Checking now..."
        break
    fi
done

echo "Watching" $project "project in directory" $path
echo "To exit project press Command/Control + C"

cd $path
compass watch $project

See problem solution here

Issue when settings a default path in BASH

I have a BASH scripting question. I'd like the mention that I am new to BASH scripting; however, I am now new to programming. I am developing a simple BASH script to watch a given compass project. My script is shown below.

I would like to allow a user to optionally enter in a custom path or use the default http_path value. I'm not sure how to set the path variable equal to the http_path variable where my default Apache directory is located using my current script. If any one has better suggestions and/or resources for learning how to write BASH scripts, please share!

Note: I have searched this site, google, and stackoverflow for an answer. If you find one with a solution to my issue, please let me know!

#!/bin/bash
# This script will watch a given compass project
http_path=/var/www/

echo -n "Enter in a new path and press. To use the default path $http_path press [ENTER] twice"

while read path; do
    if [ -z "${path}" ]; then
        clear  
        # these two lines enable the script to work if I do not
        # I do not prompt for default path. It's been tested and works
        # echo "That was empty, do it again!"
        # echo -n "Enter in a compass project directory and press [ENTER]"
        echo "Are you sure you would like to use the default path? Press [ENTER] to continue..."
        $path=$http_path
    else
        echo "Checking now..."
        break
    fi
done

echo -n "Enter in a project to watch and prss [ENTER]"

while read project; do
    if [ -z "${project}" ]; then
        clear  
        echo "That was empty, do it again!"
        echo -n "Enter in a compass project name and press [ENTER]"
    else
        echo "Checking now..."
        break
    fi
done

echo "Watching" $project "project in directory" $path
echo "To exit project press Command/Control + C"

cd $path
compass watch $project

See problem solution here

Issue when setting a default path in BASH

I have a BASH scripting question. I'd like the mention that I am new to BASH scripting; however, I am not new to programming. I am developing a simple BASH script to watch a given compass project. My script is shown below.

I would like to allow a user to optionally enter a custom path or use the default http_path value. I'm not sure how to set the path variable equal to the http_path variable where my default Apache directory is located using my current script. If any one has better suggestions and/or resources for learning how to write BASH scripts, please share!

Note: I have searched this site, Google, and stackoverflow for an answer. If you find one with a solution to my issue, please let me know!

#!/bin/bash
# This script will watch a given compass project
http_path=/var/www/

echo -n "Enter in a new path and press. To use the default path $http_path press [ENTER] twice"

while read path; do
    if [ -z "${path}" ]; then
        clear  
        # these two lines enable the script to work if I do not
        # I do not prompt for default path. It's been tested and works
        # echo "That was empty, do it again!"
        # echo -n "Enter in a compass project directory and press [ENTER]"
        echo "Are you sure you would like to use the default path? Press [ENTER] to continue..."
        $path=$http_path
    else
        echo "Checking now..."
        break
    fi
done

echo -n "Enter in a project to watch and prss [ENTER]"

while read project; do
    if [ -z "${project}" ]; then
        clear  
        echo "That was empty, do it again!"
        echo -n "Enter in a compass project name and press [ENTER]"
    else
        echo "Checking now..."
        break
    fi
done

echo "Watching" $project "project in directory" $path
echo "To exit project press Command/Control + C"

cd $path
compass watch $project

See problem solution here

added 75 characters in body
Source Link
djthoms
  • 169
  • 5

I have a BASH scripting question. I'd like the mention that I am new to BASH scripting; however, I am now new to programming. I am developing a simple BASH script to watch a given compass project. My script is shown below.

I would like to allow a user to optionally enter in a custom path or use the default http_path value. I'm not sure how to set the path variable equal to the http_path variable where my default Apache directory is located using my current script. If any one has better suggestions and/or resources for learning how to write BASH scripts, please share!

Note: I have searched this site, google, and stackoverflow for an answer. If you find one with a solution to my issue, please let me know!

#!/bin/bash
# This script will watch a given compass project
http_path=/var/www/

echo -n "Enter in a new path and press. To use the default path $http_path press [ENTER] twice"

while read path; do
    if [ -z "${path}" ]; then
        clear  
        # these two lines enable the script to work if I do not
        # I do not prompt for default path. It's been tested and works
        # echo "That was empty, do it again!"
        # echo -n "Enter in a compass project directory and press [ENTER]"
        echo "Are you sure you would like to use the default path? Press [ENTER] to continue..."
        $path=$http_path
    else
        echo "Checking now..."
        break
    fi
done

echo -n "Enter in a project to watch and prss [ENTER]"

while read project; do
    if [ -z "${project}" ]; then
        clear  
        echo "That was empty, do it again!"
        echo -n "Enter in a compass project name and press [ENTER]"
    else
        echo "Checking now..."
        break
    fi
done

echo "Watching" $project "project in directory" $path
echo "To exit project press Command/Control + C"

cd $path
compass watch $project

See problem solution here

I have a BASH scripting question. I'd like the mention that I am new to BASH scripting; however, I am now new to programming. I am developing a simple BASH script to watch a given compass project. My script is shown below.

I would like to allow a user to optionally enter in a custom path or use the default http_path value. I'm not sure how to set the path variable equal to the http_path variable where my default Apache directory is located using my current script. If any one has better suggestions and/or resources for learning how to write BASH scripts, please share!

Note: I have searched this site, google, and stackoverflow for an answer. If you find one with a solution to my issue, please let me know!

#!/bin/bash
# This script will watch a given compass project
http_path=/var/www/

echo -n "Enter in a new path and press. To use the default path $http_path press [ENTER] twice"

while read path; do
    if [ -z "${path}" ]; then
        clear  
        # these two lines enable the script to work if I do not
        # I do not prompt for default path. It's been tested and works
        # echo "That was empty, do it again!"
        # echo -n "Enter in a compass project directory and press [ENTER]"
        echo "Are you sure you would like to use the default path? Press [ENTER] to continue..."
        $path=$http_path
    else
        echo "Checking now..."
        break
    fi
done

echo -n "Enter in a project to watch and prss [ENTER]"

while read project; do
    if [ -z "${project}" ]; then
        clear  
        echo "That was empty, do it again!"
        echo -n "Enter in a compass project name and press [ENTER]"
    else
        echo "Checking now..."
        break
    fi
done

echo "Watching" $project "project in directory" $path
echo "To exit project press Command/Control + C"

cd $path
compass watch $project

I have a BASH scripting question. I'd like the mention that I am new to BASH scripting; however, I am now new to programming. I am developing a simple BASH script to watch a given compass project. My script is shown below.

I would like to allow a user to optionally enter in a custom path or use the default http_path value. I'm not sure how to set the path variable equal to the http_path variable where my default Apache directory is located using my current script. If any one has better suggestions and/or resources for learning how to write BASH scripts, please share!

Note: I have searched this site, google, and stackoverflow for an answer. If you find one with a solution to my issue, please let me know!

#!/bin/bash
# This script will watch a given compass project
http_path=/var/www/

echo -n "Enter in a new path and press. To use the default path $http_path press [ENTER] twice"

while read path; do
    if [ -z "${path}" ]; then
        clear  
        # these two lines enable the script to work if I do not
        # I do not prompt for default path. It's been tested and works
        # echo "That was empty, do it again!"
        # echo -n "Enter in a compass project directory and press [ENTER]"
        echo "Are you sure you would like to use the default path? Press [ENTER] to continue..."
        $path=$http_path
    else
        echo "Checking now..."
        break
    fi
done

echo -n "Enter in a project to watch and prss [ENTER]"

while read project; do
    if [ -z "${project}" ]; then
        clear  
        echo "That was empty, do it again!"
        echo -n "Enter in a compass project name and press [ENTER]"
    else
        echo "Checking now..."
        break
    fi
done

echo "Watching" $project "project in directory" $path
echo "To exit project press Command/Control + C"

cd $path
compass watch $project

See problem solution here

Source Link
djthoms
  • 169
  • 5
Loading