user4434778
user4434778

Reputation:

No such file or directory ERROR. Part of pathname is exported in .bash_profile

Inside a script I have named monitor power I have a variable named CHARGE_CYCLES:

CHARGE_CYCLES="$TOOLS/Data/Charge\ Cycles.txt"

The variable $TOOLS is declared and exported in my .bash_profile because I want it to be available to various scripts:

TOOLS=/Users/sl/.Tools
export TOOLS

I have a line in monitor power that uses the variable CHARGE_CYCLES:

cat "$CHARGE_CYCLES"

However, upon running the script I get the error:

/Users/sl/.Tools/Data/Charge\ Cycles.txt: No such file or directory

The annoying thing is that this file DOES exist in this exact spot. Spelling, capitalization, everything is exactly the same. So I'm thinking it has something to do with exporting TOOLS from .bash_profile but I don't see why because the error prints the exact pathname I wanted, it just says it doesn't exist.

I'm new to this stuff, so I don't really know what's going on here! Any help would be greatly appreciated!

Upvotes: 1

Views: 2175

Answers (1)

Diego
Diego

Reputation: 1819

You don't need to escape the space character when defining CHARGE_CYCLES.

Upvotes: 0

Related Questions