Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to
LinuxQuestions.org , a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free.
Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please
contact us . If you need to reset your password,
click here .
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
07-06-2008, 04:02 AM
#16
Moderator
Registered: Sep 2003
Location: Bologna
Distribution: OpenSUSE 12.1 CentOS 6.2
Posts: 9,005
Please, post the exact command line you've used along with the assignments of BASENAME, STARTDIR, ENDDIR. On my system it works fine:
Code:
$ BASENAME=test
$ STARTDIR=1
$ ENDDIR=12
$ mkdir $BASENAME$(seq -w -s " $BASENAME" $STARTDIR $ENDDIR)
$ ls
test01 test02 test03 test04 test05 test06
test07 test08 test09 test10 test11 test12
Last edited by colucix; 07-06-2008 at 04:10 AM .
07-06-2008, 07:41 AM
#17
Member
Registered: Feb 2008
Distribution: Debian wheezy
Posts: 130
Original Poster
Rep:
Hi, this is what I punched in:
Code:
mojoman@jukejoint:~/new$ BASEDIR=test
mojoman@jukejoint:~/new$ STARTDIR=1
mojoman@jukejoint:~/new$ ENDDIR=12
mojoman@jukejoint:~/new$ mkdir $BASENAME$(seq -w -s " $BASENAME" $STARTDIR $ENDDIR)
mojoman@jukejoint:~/new$ ls
01 02 03 04 05 06 07 08 09 10 11 12
mojoman@jukejoint:~/new$
Also:
Code:
mojoman@jukejoint:~/new$ bash --version
GNU bash, version 3.2.39(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.
mojoman@jukejoint:~/new$
Any ideas on what I'm doing wrong?
Thanks
07-06-2008, 08:01 AM
#18
Member
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 706
Rep:
Hi.
In many cases,
nounset is a good friend:
Code:
#!/bin/bash3 -
# @(#) user3 Demonstrate use of nounset.
echo "(Versions displayed with local utility \"version\")"
version >/dev/null 2>&1 && version =o $(_eat $0 $1)
echo
set -o nounset
BASEDIR=test
STARTDIR=1
ENDDIR=12
echo $BASENAME$(seq -w -s " $BASENAME" $STARTDIR $ENDDIR)
exit 0
Producing:
Code:
% ./user3
(Versions displayed with local utility "version")
Linux 2.6.11-x1
GNU bash 3.00.16(1)-release
./user3: line 14: BASENAME: unbound variable
cheers, makyo
07-06-2008, 08:04 AM
#19
Moderator
Registered: Sep 2003
Location: Bologna
Distribution: OpenSUSE 12.1 CentOS 6.2
Posts: 9,005
Code:
./user3: line 14: BASENAME: unbound variable
Yes. Count Zero, you assigned BASEDIR then used BASENAME.
07-06-2008, 08:34 AM
#20
Member
Registered: Feb 2008
Distribution: Debian wheezy
Posts: 130
Original Poster
Rep:
Quote:
Originally Posted by
colucix
Code:
./user3: line 14: BASENAME: unbound variable
Yes. Count Zero, you assigned BASEDIR then used BASENAME.
Arghh! (slams forehead really hard into keyboard)
Thanks! That was it. I don't know how I missed it. I appreciate you giving your time, effort and expertise.
I'll also be using the nounset option in the future...
Cheers!
Thread Tools
Search this Thread
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT -5. The time now is 08:48 AM .
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know .
Latest Threads
LQ News