Skip to main content

All Questions

Filter by
Sorted by
Tagged with
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 ...
TeslaS's user avatar
  • 11
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 ...
Brōtsyorfuzthrāx's user avatar
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 ...
SweGoat's user avatar
  • 43
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 ...
a.t.'s user avatar
  • 347
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-...
McLan's user avatar
  • 251
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: ...
Enzo's user avatar
  • 143
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 ...
dimpol's user avatar
  • 519
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/...
Byte Commander's user avatar
  • 109k
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....
Piteight's user avatar
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 ...
NAE's user avatar
  • 41
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 ...
McLan's user avatar
  • 251
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 ...
Jone Bambo's user avatar
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 ...
Michael James's user avatar
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.
mreq's user avatar
  • 4,882