Python Forum
How to use a variable in linux command in python code? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: How to use a variable in linux command in python code? (/thread-36651.html)



How to use a variable in linux command in python code? - ilknurg - Mar-14-2022

I have a python code. In my code I run this commands via os.system. How can i give sAMAccountName as a parameter?

I have a variable which is name. It can change in every search. I want to write name instead of the sAMAccount, and command will run according to it.

ldapsearch -x -H "ldap://192.168.1.240:368" -D "[email protected]" -w "foo" -b "dc=my,dc=server" '(sAMAccountName=user1)'



RE: How to use a variable in linux command in python code? - ndc85430 - Mar-14-2022

Do you un


RE: How to use a variable in linux command in python code? - ndc85430 - Mar-14-2022

Do you understand f-strings, or at least string concatenation?