Python Forum
coming up with a sentinel string for file names
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
coming up with a sentinel string for file names
#1
i am designing a few commands which need to have 2 lists of file or directory names. what i need to come up with is some string that is reasonable to use as a sentinel to indicate where the 1st list ends on the command line and the 2nd list ends. the sentinel marker is not part of either list. this string needs to be something easy to enter on an interactive shell, possible to code in all scripting languages that can run commands, and unlikely to be a used file system object name. one possible marker is "--" that many unix commands already use to end options. but i was thinking of using ",". are there any better ideas?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
You could use repeatable switches like -I in gcc. The CLI tools of the plumbum module implement this. You can write
Output:
./example.py -I/foo/bar -I/usr/include
Reply
#3
i really don't want to type in something more than each name or path by itself. my latest thought is to use "//" as the separator.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#4
Why not use a word such as then?
Output:
mycommand spam.py eggs.txt tmp/bacon.c then ../bar foo.sqlite /tmp/qux
If a file is named then, one can use "then" in a list.

EDIT: thinking again, "then" is not a good idea because it is a reserved word in Bash. Why not "also"?
Output:
mycommand spam.py eggs.txt tmp/bacon.c also ../bar foo.sqlite /tmp/qux
Reply
#5
or maybe "..."?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python coming to DroidScript (build native Android Apps) d_a_v_e 5 1,601 Feb-20-2024, 05:48 PM
Last Post: d_a_v_e
  is there an implied encodin in file names being opened? Skaperen 10 2,788 Mar-15-2022, 10:21 PM
Last Post: Skaperen
  coming up with a sentinel string for file names lacaca 1 1,875 Apr-13-2019, 09:31 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020