Я использую немного сценария Python, который оценит выражение Python и распечатает результат, затем я могу выполнить что-то как
$ pc '[i ** 2 for i in range(10)]'
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
сценарий:
#!/usr/local/bin/python3
import sys
import traceback
from codeop import CommandCompiler
compile = CommandCompiler()
filename = "<input>"
source = ' '.join(sys.argv[1:]) + '\n'
try:
code = compile(source, filename)
except (OverflowError, SyntaxError, ValueError):
type, value, sys.last_traceback = sys.exc_info()
sys.last_type = type
sys.last_value = value
if filename and type is SyntaxError:
# Work hard to stuff the correct filename in the exception
try:
msg, (dummy_filename, lineno, offset, line) = value.args
except ValueError:
# Not the format we expect; leave it alone
pass
else:
# Stuff in the right filename
value = SyntaxError(msg, (filename, lineno, offset, line))
sys.last_value = value
lines = traceback.format_exception_only(type, value)
print(''.join(lines))
else:
if code:
exec(code)
else:
print('incomplete')
К сожалению, я не помню, где я одолжил большую часть кода у, таким образом, я не могу процитировать его.
Уже существует названный файл /home/alessiomtx/.config/tint2
, но это не каталог.
Возможно, Вы означали редактировать /home/alessiomtx/.config/tint2
?
Если Вам действительно нужен названный файл /home/alessiomtx/.config/tint2/tint2rc
, переместите существующий файл /home/alessiomtx/.config/tint2
из пути.
mv /home/alessiomtx/.config/tint2 /home/alessiomtx/.config/tint2.old
mkdir /home/alessiomtx/.config/tint2
Но возможно это tint2
файл является некоторым старым названием, и файл должен быть перемещен в tint2/tint2rc
?
mv /home/alessiomtx/.config/tint2 /home/alessiomtx/.config/tint2rc
mkdir /home/alessiomtx/.config/tint2
mv /home/alessiomtx/.config/tint2rc /home/alessiomtx/.config/tint2/