Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

"md5" fails as dir name ?

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
5 posts • Page 1 of 1
Author
Message
Gentree
Watchman
Watchman
User avatar
Posts: 5350
Joined: Tue Jul 01, 2003 12:51 am
Location: France, Old Europe

"md5" fails as dir name ?

  • Quote

Post by Gentree » Sun Mar 11, 2007 1:41 am

Hi,

I have been banging my head against this problem all evening but have finally tracked it down to a very odd bash error.

I need to copy some files like the md5 checksums on Suse, so I decided to make a temp dir called md5 to work on them but the directories never got created.

No error to console , nothing in logs, mkdir did not seem to return any error code either.

I finally found that if I called it md55 or just about any other name it worked as expected. I can also do I from cli, so why the hell cant bash do it within a script and more over why dont I get an error?

Code: Select all

#!/bin/bash

READBACK=/wine/suse-readback/;
TARGET=/wine/SU102-DVD/;
CD_ISO_DIR=/var/www/localhost/htdocs/;
DVD_ISO_DIR=/wine/suse-dvd/;
ISOBASENAME="openSUSE-10.2-GM-i386-";
pwd

[ -d $TARGET ] && rm -rf $TARGET;
mkdir -p $TARGET;
#[ -d $READBACK ] || mkdir -p $READBACK

echo "i586">files.txt;
echo "i686">>files.txt;
echo "noarch">>files.txt;
for PLATFORM in `cat files.txt` ; do
#  PLATFORM="i686";
MD5="md5";
#  mkdir -p $TARGET$MD5;

 mkdir -p $TARGET$MD5 || echo "make md5 failed";
done

  echo  $TARGET$MD5$PLATFORM;
now if anyone can explain I'd like to hear it.

TIA, Gentree. 8)
Linux, because I'd rather own a free OS than steal one that's not worth paying for.
Gentoo because I'm a masochist
AthlonXP-M on A7N8X. Portage ~x86
Top
iphands
n00b
n00b
Posts: 61
Joined: Sat Oct 01, 2005 3:46 am

  • Quote

Post by iphands » Sun Mar 11, 2007 2:11 am

Weird...

Code: Select all

#!/bin/bash
TARGET="tmp/";
MD5="md5";
mkdir -p ${TARGET}${MD5} || echo "make md5 failed";
This does work for me....

I'd like to know too though... I'm a big bash person.
Top
Gentree
Watchman
Watchman
User avatar
Posts: 5350
Joined: Tue Jul 01, 2003 12:51 am
Location: France, Old Europe

  • Quote

Post by Gentree » Sun Mar 11, 2007 10:11 am

thanks for the reply.

I have got a bit further by putting braces around everything and replacing all literals by vars. A bit of a hack but I obviously need to read up on bash syntax.

What is confusing me in debugging this is that these lines are failing without giving and error condition or message so my || echo "this bit failed" clauses are not providing any level of checking.

can you help with that?

If I had some feedback that things were failing I'd have more chance of tracking the error.

Thx. 8)
Linux, because I'd rather own a free OS than steal one that's not worth paying for.
Gentoo because I'm a masochist
AthlonXP-M on A7N8X. Portage ~x86
Top
Genone
Retired Dev
Retired Dev
User avatar
Posts: 9656
Joined: Fri Mar 14, 2003 6:02 pm
Location: beyond the rim

  • Quote

Post by Genone » Sun Mar 11, 2007 2:41 pm

That's probably because a) the variables expanded to *something* and b) the -p option doesn't cause an error if the dir already exists. Take this case as a good example why you should always use quotes and braces when referencing variables.

PS: you don't need all those semicolons
Top
iphands
n00b
n00b
Posts: 61
Joined: Sat Oct 01, 2005 3:46 am

  • Quote

Post by iphands » Sun Mar 11, 2007 4:28 pm

Genone wrote:PS: you don't need all those semicolons
ditto....
Top
Post Reply

5 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic