ewhitt
ewhitt

Reputation: 947

Bash script to install dependencies and provide status feedback

I am trying to create a bash script to install packages and provide feedback, e.g. "Processing package: gcc, Package 1 of 17". I have the following:

#!/bin/bash

dep_ubuntu = "dep1 dep2 dep3 dep4 dep5"

length=$(echo $dep_ubuntu | wc -w)

for pkg in $dep_ubuntu; do
    echo "Processing ${pkg}, Package $pkg of $length"
done

When I try to run this code, I experience "line 3: dep_ubuntu: command not found". Am I using the wrong types of quotes to declare this?

Upvotes: 1

Views: 1366

Answers (2)

ewhitt
ewhitt

Reputation: 947

I figured it out. I can't have a space between the variable and data.

Upvotes: 0

Ray
Ray

Reputation: 1869

You don't need the spaces around the =:

dep_ubuntu="dep1 dep2 dep3 dep4 dep5"

Upvotes: 3

Related Questions