Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-20-2007, 12:48 PM   #1
LQ Newbie
Registered: Oct 2004
Location: Austria
Posts: 5

Rep: Reputation: 0
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
Old 10-20-2007, 01:08 PM   #2
LQ Newbie
Registered: Oct 2004
Location: Austria
Posts: 5

Original Poster
Rep: Reputation: 0
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*


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
"bad interpreter : no such file or directory" when configure "flex" acer_peri Linux - Software 10 11-10-2010 02:19 AM
LFS 6.2 Ch. 6.14 - 2nd Coreutils test returns "/bin.bash: No such file or directory" 0graham0 Linux From Scratch 2 08-23-2007 07:32 PM
What does "Directory "/usr/src/linux" doesn't appear to contain kernel source." mean? jtp51 Linux - General 4 06-11-2007 01:22 AM
"WARNING: Circular directory structure" error when deleting directory pistonbrew Linux - Software 5 02-03-2005 07:05 AM
Error in man command "sh: line 1: /usr/bin/gtbl: No such file or directory" MinA Slackware 1 09-06-2004 07:36 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:10 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration