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

20328Re: [Clip] Re: ^!MkDir

Expand Messages
  • Al
    Feb 4, 2010
      Alec Burgess wrote:

      <snip has cygwin on Win XP>
      > Al - if you do mkdir --help do you have the -p option?
      >
      Yours didn't (go OT) 'cause I guess you can use Notetab to run your
      Cygwin bash shell. BTW I used to run Cygwin (which has a rather
      powerful bash shell, BTW). But see my "sys" a few paragraphs down, I no
      longer have a need for Cygwin.

      Mine post here speaks not of Notetab but of "program able" and mkdir as
      relative to the bash shell.

      So, as courtesy, I would go to Off Topic list if/with yet any further in
      this "program able" vein that is or falls outside of the realm of
      Notetab and DOS or the program able Notetab editor. Thank you.

      al@P5Q:~$ cat /etc/slackware-version
      Slackware 12.2.0
      al@P5Q:~$

      Yep, mkdir -p (So I have at least 2 different ways to do it natively
      already onboard my sys) (ha ha, I got Win beat <grin>) -- my sys is
      Slackware 12.2 with the KDE desktop. On this sys is also the KVM virtual
      machine in which, amongst others, I have a Win XP and a Win 7 (which, at
      my whim) I may run and also I may use in said virtual machine. (I do
      have Notetab on that Win which runs in KVM).

      On my sys mkdir is a binary executable (the Linux equvalent of a Win
      .exe file) (Linux does not use file extensions which is a Win thing)

      al@P5Q:/bin$ lsag mkdir
      -rwxr-xr-x 1 root root 30968 2008-09-20 20:18 mkdir*
      al@P5Q:/bin$ pwd
      /bin
      al@P5Q:/bin$


      note: in next, the 1st ls returned nothing which means tst is an empty dir
      until we run the mkdir -p command and then ls now reveals sub folder(s)

      al@P5Q:~/temp/tst$ ls
      al@P5Q:~/temp/tst$ mkdir -p ./test1/test2/test3
      al@P5Q:~/temp/tst$ ls
      test1/
      al@P5Q:~/temp/tst$ cd test1/test2/test3
      al@P5Q:~/temp/tst/test1/test2/test3$ pwd
      /home/al/temp/tst/test1/test2/test3
      al@P5Q:~/temp/tst/test1/test2/test3$


      on my sys, mkdirhier is a sh (shell script). Just as DOS is scriptable,
      as Hugo pointed out, so is the Linux bash shell
      (scriptable/programmable) very much so.

      So, program able Notetab editor, program able DOS, program able bash shell.


      al@P5Q:~$ which mkdirhier
      /usr/bin/mkdirhier

      al@P5Q:~$ cat /usr/bin/mkdirhier
      #!/bin/sh
      # $Xorg: mkdirhier.sh,v 1.3 2000/08/17 19:41:53 cpqbld Exp $
      # Courtesy of Paul Eggert

      newline='

      <snip various case scenarios (protections against idiot user or
      keyboarding mistake)>
      <y'all don't want a bunch of new lines as a folder name on your hard
      drive, right?>

      # next, can seen the for loop that does the actual duty
      # It's much like the for loop that Hugo pointed out, DOS script style
      # but this is a bash script, not a DOS batch file

      for filename
      do
      path=$prefix$filename
      prefix=$path/
      shift

      test -d "$path" || {
      paths=$path
      for filename
      do
      if [ -n "$filename" -a "$filename" != "." ]; then
      path=$path/$filename
      paths=$paths$newline$path
      fi
      done

      mkdir $paths || status=$?

      break
      }
      done
      done

      exit $status
      # end

      Alan.
    • Show all 21 messages in this topic