-   Linux - Newbie (
-   -   Bash scripting: "line [...]: [directory]: is a directory " ? (

serious 10-20-2007 11:48 AM

Bash scripting: "line [...]: [directory]: is a directory " ?
hi everyone.

I have to write a "useful" bash script for university, but have some troubles. the script should sync two folders, but atm I can't even get the basics working.
the problem is that I wanted to define two variables within the script which can be assigned by the user or use certain default values. but this didn't really work out. atm the script throws me an error when I don't specify a variable.

the code is:

if [ "$1" == "" ]; then

if [ "$2" == "" ]; then

the error occurs in line 2 ("DIR1=$(~)") where I get the error message described in the title. what did I do wrong? or is there a more elegant solution for what I want to do? and why does it work with "DIR2=$(pwd)"?

hope someone can help me
with kindest regards

serious 10-20-2007 12:08 PM

argh, so clear. simply without the $(..) and it works great. was too much influenced by the $(pwd) as I wrote that before and thought it would work this way also with the ~ *hitting head hard against wall*

All times are GMT -5. The time now is 06:58 PM.