How to execute python script in Linux? [closed] - linux

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I would like to make a python script that would do some work with interfaces file in Linux.
How I may make this script executable in Linux? I would to open it with sudo and it would do some commands in terminal.

Make callable
chmod u+x <filename here>
first line in file with shebang to determine how the script should be executed:
#!/usr/bin/python3
execute with
./<filename here>

Related

Linux script with cd and read [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 months ago.
Improve this question
Is there any way I can integrate cd command with read?
read -p "location" loc
cd /home/dir/$loc
Yes, you can; it's not pretty, but it works. :)
cd /home/dir/$( read -p "location" loc; echo $loc)
It's also a bit costly as it invokes a sub-shell.

How can install arm-linux-gcc-3.3.2.tar.bz2 on ubuntu [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I'm trying to make cross compiler. And I commend like tar xvjf arm-linux-gcc-3.3.2.tar.bz2. But when ls /usr/local/arm there is nothing. arm directory doesn't exsist.... I dont know what to do.....
The command that you have there:
tar xvjf arm-linux-gcc-3.3.2.tar.bz2
extracts that archive within the directory you are currently in. So, if you expect things to show in /usr/local/arm ... you have to copy them there!
Thats about it - see here!

How to execute bash script without password? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I need to execute the script after system boot.
For example:
(sleep 5 && (sudo dhcpcd wlp4s0))
What I need: Executing the script.
What I have: [sudo] password for eugene:
I has been edited /etc/sudoers so:
eugene ALL=NOPASSWD: /home/eugene/dhcpcdstart.sh
But it's ineffectually. How I can to execute the current script without password?
Arch Linux 2013.05.01
I just tested your sudoers configuration and it works (not with dhcpcd, since I don't have it). Just make sure that you put that line at the end of sudoers file containing dhcpcd in the file list (I guess your script has executing rights for eugene user, but dhcpcd doesn't).
eugene ALL=NOPASSWD: dhcpcd_path/dhcpcd

Linux command line....How do I change from $ to #? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm working with the sed editor and I realize that my command prompt is:
[darkchild#localhost ~]$
How can I change this so that it ends in #....and what does this mean?
for example:
[darkchild#localhost ~]#
A friend told me to write this command #!/bin/bash but it does not change the prompt to #.
Can someone educate me?
Canonically # means root shell. You probably do not actually want to do this, because it would confuse other users of your system. If you do actually want to do this, you can edit the PROMPT variable.
http://tldp.org/HOWTO/Bash-Prompt-HOWTO/
You can run the following command:
set prompt=\[`id -nu`#`hostname -s`\]\#\
This is the root user. You can go to this user using the su command.
More info: http://en.wikipedia.org/wiki/Su_(Unix)

How to execute a script on linux ssh...? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
How do I execute a script on ssh? I need to execute:
/scripts/makecpphp
So I have tried run /scripts/makecpphp but it didn't work. Any help would be greatly appreciate. I know for sure that that file exists there.
If the script is on the remote machine:
ssh user#foo.example.com /scripts/makecpphp
If it's on the local machine:
/scripts/makecpphp
If makecpphp is executable, you just need to type:
./scripts/makecpphp
Are you sure it's executable? Note that this does not just apply over ssh, but any time you are running programs via a linux command line.
If it's executable, just do
/scripts/makecpphp
Otherwise you can do (replace $INTERPRETER by the used interpreter, eg bash, python,...)
$INTERPRETER /scripts/makecpphp
First off, do you have the permission to execute it and is it executable?
Secondly, I don't believe you would use run. You'd cd to the directory and then type
./makecpphp
you need to have execute permission on the script.
chmod +x /scripts/makecpphp
then run
/scripts/makecpphp

Resources