--- a/cwltool/command_line_tool.py
+++ b/cwltool/command_line_tool.py
@@ -31,7 +31,7 @@
     cast,
 )
 
-import shellescape
+import shlex
 from mypy_extensions import mypyc_attr
 from ruamel.yaml.comments import CommentedMap, CommentedSeq
 from schema_salad.avro.schema import Schema
@@ -1164,7 +1164,7 @@
             for b in builder.bindings:
                 arg = builder.generate_arg(b)
                 if b.get("shellQuote", True):
-                    arg = [shellescape.quote(a) for a in aslist(arg)]
+                    arg = [shlex.quote(a) for a in aslist(arg)]
                 cmd.extend(aslist(arg))
             j.command_line = ["/bin/sh", "-c", " ".join(cmd)]
         else:
--- a/cwltool/job.py
+++ b/cwltool/job.py
@@ -35,7 +35,7 @@
 )
 
 import psutil
-import shellescape
+import shlex
 from prov.model import PROV
 from schema_salad.sourceline import SourceLine
 from schema_salad.utils import json_dump, json_dumps
@@ -271,7 +271,7 @@
             self.outdir,
             " \\\n    ".join(
                 [
-                    shellescape.quote(str(arg)) if shouldquote(str(arg)) else str(arg)
+                    shlex.quote(str(arg)) if shouldquote(str(arg)) else str(arg)
                     for arg in (runtime + self.command_line)
                 ]
             ),
--- a/setup.py
+++ b/setup.py
@@ -126,7 +126,6 @@
         # https://github.com/ionrock/cachecontrol/issues/137
         "ruamel.yaml >= 0.16, < 0.19",
         "rdflib >= 4.2.2, < 7.1.0",
-        "shellescape >= 3.4.1, < 3.9",
         "schema-salad >= 8.7, < 9",
         "prov >= 1.5.1",
         "mypy-extensions",
