You can use
ruby -e 'print "file: #{File.basename(ARGF.filename, '"'.*'"')}"' test.adoc
The File.basename
with the second argument set to .*
returns file name without any extensions, but you need to quote the single quotes correctly in order to keep syntax right.
In '"'.*'"'
, the first '
closes the currently open '
before print
, then "'.*'"
adds '.*'
to the line of code, then '
re-starts the code line to be closed with the trailing '
.
CLICK HERE to find out more related problems solutions.