Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
62 user(s) are online (34 user(s) are browsing Forums)

Members: 2
Guests: 60

VooDoo, salass00, more...

Headlines

 
  Register To Post  

AmigaDOS echo bug found
Home away from home
Home away from home


See User information
I was looking at this documentation.

http://amiga.sourceforge.net/amigadev ... up=AmigaDOS&action=Search

I'm not so good with AmigaDOS scripts, what I wont to do is remove the "/" from a string.

I using "c:requestfile" to get directory.

I'm getting something like "Ram disk:t/"
So I wont to make directory inside "Ram disk:t/"

I have done like:
Set mydir ´c:requestfile title "pick directory"´
Trying to do.
Makedir $mydirNEWDIR

Results in $mydirNEWDIR

don't work, so trying to do:

Makedir $mydir/MYDIR

Results in "Ram Disk:t//MYDIR", this wont work as "//" is parent directory in AmigaOS.

So I was thinking what If removed "/" from back of $mydir.
looking at documentation, I found that echo can take parts of string.

But only from the first chars, to length, as I have coded in PHP, I know that using negative length values, might product what I wanted. So I tried.

echo len -1 "$mydir"

this resulted is a frozen AmigaOS.

http://www.w3schools.com/php/func_string_substr.asp

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: AmigaDOS echo bug found
Just popping in
Just popping in


See User information
@LiveForIt

If my memory serves me right:

Quote:
Makedir $mydirNEWDIR


You need to use the brackets, so that the script knows when the name of the variable ends.

The standard brackets in DOS are < and > so:

Makedir $<mydir>NEWDIR

should work.

If you need the redirections you can set other brackets with:
.bra {
.
ket }

Makedir ${mydir}NEWDIR


Go to top
Re: AmigaDOS echo bug found
Home away from home
Home away from home


See User information
@Gazelle

Thanks it worked.

Anyway it be nice if, echo supported the -1 len value, never know when you need to remove the last chars from a string.

Crashing is not that nice.

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: AmigaDOS echo bug found
Just can't stay away
Just can't stay away


See User information
Bug report (and enhancement request) submitted to OS4 Bugzilla.

Philippe 'Elwood' FERRUCCI
Sam460ex 1.10 Ghz
http://elwoodb.free.fr
Go to top
Re: AmigaDOS echo bug found
Just can't stay away
Just can't stay away


See User information
I had similar problems and in the end wrote my own program to do it as I found both echo and cut to be unsatisfactory.

Here's the help from my command:

> cutstring
CutString V0.04 (c)14.12.2014 Nick Clover
STRING/A,L=LEFT/S,R=RIGHT/S,M=MID/S,D=DRIVE/S,P=PATH/S,F=FILENAME/S,N=NAME/S,E=EXT/S,START/N,NUMCHARS/N

Examples:
CutString "hello world" LEFT 5 -> "hello"
CutString "hello world" RIGHT 5 -> "world"
CutString "hello world" MID 5 4 -> "o wo"
CutString "hello world" MID 5 -> "o world"
CutString "work:examples/doc1.txt" DRIVE -> "work:"
CutString "work:examples/doc1.txt" PATH -> "work:examples/"
CutString "work:examples/doc1.txt" FILENAME -> "doc1.txt"
CutString "work:examples/doc1.txt" NAME -> "doc1"
CutString "work:examples/doc1.txt" EXT -> "txt"
If no switch is given MID is used.
If a negative value is used for LEFT or RIGHT characters are cut off the end. eg.
CutString "work:examples/" RIGHT -1 -> "work:examples"


Amiga user since 1985
AOS4, A-EON, IBrowse & Alinea Betatester

Ps. I hate the new amigans website. <shudder>
Go to top
Re: AmigaDOS echo bug found
Just can't stay away
Just can't stay away


See User information
@LiveForIt:

In your specific situation described above, you'd probably be much better off investigating the C:PathPart command. Check out "help pathpart".

Best regards,

Niels

Go to top
Re: AmigaDOS echo bug found
Quite a regular
Quite a regular


See User information
Quote:
Makedir $mydirNEWDIR

Results in $mydirNEWDIR

don't work, so trying to do:

Makedir $mydir/MYDIR

Results in "Ram Disk:t//MYDIR", this wont work as "//" is parent directory in AmigaOS.


In addition to Gazelle's response, another solution to that is to join two environment variables together, like $mydir$mydir2

Go to top
Re: AmigaDOS echo bug found
Just can't stay away
Just can't stay away


See User information
Best solution would be using c:pathpart as suggested by nbache.

Makedir "`pathpart "$mydir" NEWDIR`"

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project