All Questions
14 questions
0
votes
2
answers
89
views
Adding simple shortcut on the terminal, the right way
I am trying to add folder to PATH variable (for specific user only).
so to ~/.bashrc i have added
export PATH=$PATH:/home/username/Tools/scripts/
within this folder i am having scripts and some ...
0
votes
1
answer
716
views
How do I use sudo on a script I made myself that is already in my path and executable?
How do I make a script that I made myself that I already put in my path and made executable usable with sudo? (Xubuntu 22.04.1.)
The script is located here: ~/bin/myScript.
When, from an arbitrary ...
4
votes
1
answer
6k
views
How to run scripts that are in PATH?
I'm pretty much completely new to Ubuntu, so bear with me.
I have made a few scrips without the .sh extension and granted them permission with chmod 755, and the scripts run just fine as long as I'm ...
1
vote
1
answer
3k
views
Pass/set `current directory` to/for a shell script from Java in Ubuntu 16.04
While trying to automate an installation process in Ubuntu 16.04 with a .jar file, I did not know how to solve the following problem:
Problem description
Part of the installation files automatically ...
0
votes
1
answer
1k
views
How to set, permanently, my own directory instead of /home/bin in $PATH in ubuntu? [duplicate]
This might be a repeated question, but I couldn't relate to any previous answer. I basically want to run my shell-script from anywhere in ubuntu 16.04 (whether I'm inside the directory where the shell-...
4
votes
2
answers
5k
views
How to get the real path of a sh file that is being sourced
I added this line into my ~/.bashrc
. /mnt/c/Users/enzo/drive/projects/dotfiles/init.sh
And and inside of init.sh I am trying to get the path of init.sh but I am not able to.
I tried this so far:
...
32
votes
4
answers
98k
views
When writing a bash script, how do I get the absolute path of the location of the current file?
Suppose I have a bash file called myBash.bash. It resides in:
/myDirect/myFolder/myBash.bash
Now I want to use the string /myDirect/myFolder (the location of myBash.bash) inside the script. Is ...
7
votes
2
answers
615
views
Having a list of paths, how can I filter out subdirectories of previously mentioned paths?
Let's say I have a sorted list of absolute paths, like the one in my answer here (shortened and modified for this question):
/proc
/proc/sys/fs/binfmt_misc
/proc/sys/fs/binfmt_misc
/run
/run/...
3
votes
1
answer
2k
views
Create txt with full paths to files and some additional text
I have a bunch of files, in many folders and I wanted to create txt file with full paths to this files and with space and name of the directory they are in. something like:
halva/foo/bar/1/something....
1
vote
2
answers
396
views
How do I modify paths and change to a real path?
I am a beginner at Ubuntu. I am wanting to install my-udev-notify, and I was able to follow these instructions in the README.md file:
Installation
------------
- unpack archive somewhere ...
2
votes
3
answers
4k
views
How can I create a command with arguments and a configuration file? [closed]
Directly to the point, I want to give the user the flexibility to pass arguments to a command in order to control how the commands should run, something like:
pcap -d 30 -w 2
In other words:
I want ...
3
votes
2
answers
222
views
How to stock all files with the same suffix into a table?
i'm making a little shell script and i want to stock all files with same suffix in a table.
i want something like that :
path=/home/user/Documents
suffix="_suffix.txt"
and then a function that ...
2
votes
2
answers
2k
views
installing a script in $PATH
I am trying to use yeoman in Ubuntu. Everything is installed correctly but I can't use the command yo from bash. If I navigate to the appropriate directory and run node cli.js everything works from ...
17
votes
3
answers
98k
views
Launch shell scripts from anywhere [duplicate]
Is it possible to run my scripts located in ~/scripts from anywhere?
Say i want to run ./scriptname regardless of my current working directory.