Loading ...
Sorry, an error occurred while loading the content.

Re: [jasspa] Quoting shell-command

Expand Messages
  • Jon Green
    ... Try the following, no shell, no O/S dependence, no messing: !force 0x20 file-op filename Note the !force here will ignore any failures (i.e. file does
    Message 1 of 4 , Sep 24, 2005
    View Source
    • 0 Attachment
      Gadrin wrote:
      > I've been trying to figure out how to delete a file from within a
      > macro.
      >
      > I've tried a single string with the file name in quotes (the path has
      > a space in it) I've tried both the \" and \\" and have resorted to
      > the code below, but it just won't delete the file...
      >
      > set-variable %cmd &sprintf "del %s%s%s" &itoa 34 "c:/program
      > files/jasspa/microemacs/junk.txt" &itoa 34
      > ml-write %cmd
      > shell-command %cmd
      > !abort
      >
      > any ideas ?
      >
      > unless there's a better way to do it.
      >
      >

      Try the following, no shell, no O/S dependence, no messing:

      !force 0x20 file-op "filename"

      Note the !force here will ignore any failures (i.e. file does not exist), if you do not want
      this behaviour then the macro will bail out if there is a failure.

      file-op does lots of other things too so look at the manual page for this command.

      Jon.
    • Gadrin
      ... exist), if you do not want ... for this command. ... yes, much nicer. I ve been going entry-by-entry through the glossary, but sometimes when I encounter
      Message 2 of 4 , Sep 24, 2005
      View Source
      • 0 Attachment
        > Try the following, no shell, no O/S dependence, no messing:
        >
        > !force 0x20 file-op "filename"
        >
        > Note the !force here will ignore any failures (i.e. file does not
        exist), if you do not want
        > this behaviour then the macro will bail out if there is a failure.
        >
        > file-op does lots of other things too so look at the manual page
        for this command.
        >
        > Jon.

        yes, much nicer.

        I've been going entry-by-entry through the glossary, but sometimes
        when I encounter something interesting...I jump around a bit.

        thanks Gadrin
      • Thomas Hundt
        Since when does the DEL command take forward slashes? set-variable #l0 &sprintf del %s%s%s &itoa 34 c: foo.lst &itoa 34 ml-write #l0 shell-command #l0
        Message 3 of 4 , Sep 24, 2005
        View Source
        • 0 Attachment
          Since when does the DEL command take forward slashes?

          set-variable #l0 &sprintf "del %s%s%s" &itoa 34 "c:\\foo.lst" &itoa 34
          ml-write #l0
          shell-command #l0

          Seems to work.

          -Th

          Gadrin wrote:

          >I've been trying to figure out how to delete a file from within a
          >macro.

          >set-variable %cmd &sprintf "del %s%s%s" &itoa 34 "c:/program
          >files/jasspa/microemacs/junk.txt" &itoa 34
          >ml-write %cmd
          >shell-command %cmd
          >!abort
        Your message has been successfully submitted and would be delivered to recipients shortly.