Python Forum
is this string shell quote safe?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
is this string shell quote safe?
#1
i need to find or write a function that can tell me if a given string is safe or needs to be quoted when being used to pass as an argument for a command being executed through a shell like /bin/sh on a Posix system. maybe it could return the string to use, quoted (and escaped as needed), or not, as needed.
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
https://docs.python.org/3/library/shlex....hlex.quote
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#3
i was supposed to do the work of finding it.
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
  make eval() safe Skaperen 5 2,670 Mar-24-2022, 05:47 PM
Last Post: Skaperen
  finding a mismatched triple-quote in a huge module Skaperen 1 1,573 Apr-15-2020, 04:29 AM
Last Post: UGuntupalli
  after py2 EOL, is it safe to repoint python? Skaperen 6 3,261 Sep-14-2019, 10:37 AM
Last Post: snippsat
  safe text to html Skaperen 10 11,666 Jul-07-2017, 04:23 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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