Ubuntu :: Bash Wildcard To PATH?
Sep 11, 2010I have some programs compiled into /opt/programname, and I would like to be able to execute them without typing the full path; I've tried with PATH=$PATH:/opt/*/bin, but with no luck;
View 4 RepliesI have some programs compiled into /opt/programname, and I would like to be able to execute them without typing the full path; I've tried with PATH=$PATH:/opt/*/bin, but with no luck;
View 4 RepliesI need a command to search for any file in a directory like so:
/home/*/upload/* and then change permissions any file in that directory.
Find doesn't seem to match what I need.
Out of the box, Bash in 10.04 is configured such that it won't expand/complete parameters when there's a single match for a parameter with a leading wildcard. For example, if I have the following files in a directory:
Code:
ABC.bin
DEF.bin
GHI.bin
...and I type cp *E*, I expect to be able to press TAB and have Bash expand *E* to DEF.bin, since that's the only file in the directory with a capital E in its name.
(Note: if I actually submit the command with the wildcards in place, the correct file will be used then, but I don't get to see it beforehand.) I imagine there's something in /etc/bash_completion that's preventing this from working properly. Does anyone know what it is?
kernel 2.6.21.5, slackware 12.0
GNU bash 3.1.17
Code:
As you can see, /usr/local/bin is in the path. However, bash does not look for nasm in /usr/local/bin.
If I am root, things go well:
Code:
I'm trying to make a script to make it quicker to encode videos.
Code:
#!/bin/bash
echo "Type the path of the video file"
[code]....
I am trying to create a file, that has a variable assigned to it, in another directory. For some reason when I run the script it creates the file only in my pwd and I cannot for the life of me figure out why.My pwd at the moment is Desktop but it does not matter as I have tried from elsewhere. I have tried the touch command in the following ways (some will be obviously incorrect but I was desperate)and many more as well as the original format listed.
View 1 Replies View RelatedI am trying to execute executable files in bash without adding ./ I know there must be an alias to add in .bashrc, that must be something like alias PATH=$PATH:. But this seems not to be working.
View 1 Replies View RelatedI've these path:
Code:
xxx/yyy/zzz/0908/aaa/a.txt
xxx/yyy/zzz/0909/aaa/a.txt
xxx/yyy/zzz/0910/aaa/a.txt
fff/ggg/hhh/iii/jjj/0911/aaa/a.txt
fff/ggg/hhh/kkk/0912/aaa/a.txt
and I would like to extract only the number, so that I've get the result
Code:
0908
0909
0910
0911
0911
How can I do it in bash?
We have a custom app that runs on boot on some older hardware running DSL linux, and their startup manager was quite simple. We purchased some newer Asus eeebox's which run xandros and things are quite stable and run nice with 1 exception.The application only runs from the root (/) location. This box auto logs in as 'user' and there is a /home/user/.kde/Autostart folder where you can stick scripts to run at boot. So I have a start.sh script, and with little bash programming tried things such as;
sudo cd /
sudo /startapp.pl
but the errors start spewing with the basic;can't find data/xyz as it's looking in the local.I thought there was a basic cwd (change working directory) but everything I try just forces the run from that location.Any ideas or suggestions are appreciated, but things like can you change the code, etc. can't be done, so it must be a programming thing. The only other thought I had but not sure, can you do a cronjob with @boot or something, that when the box starts, it can run this job as root and fire off?
I am programming in bash and really stuck finding directory names. I have a script to find all the .php files on my / partition which will return the whole path. Is there a way to print directory hierarchy with all those values leaving out the forward slashes.
View 10 Replies View Relatedhaving bit of a trouble with path expansion of strings that contain some whitespace and wildcards First my script sources a configuration file that contains array assignments
Code:
...
BACKUP_TARGET_FILES[2]=/boot/config-* # no problems
BACKUP_TARGET_FILES[3]="/root/random dir with space/file*" # this is the problem
...
then later in the script I want to expand BACKUP_TARGET_FILES elements as below
Code:
IFS_DEFAULT="$IFS"
shopt -s nullglob
shopt -s dotglob
IFS=
[code]....
this code seems to work but I'm not quite satisfied with it. I'd like to get rid those IFS changes, but haven't found out a solution as of yet. Problem with default IFS seems to be that with it neither $pattern or "$pattern" work; it either interprets pattern as multiple words (because of spaces) and so expands to wrong paths or it ignores * because it's within quotes.
I found the following function in /etc/profile file.
[Code]...
1. I dont undestand what "if ! echo $PATH | /bin/grep -qE "(^|:)$1($|:)"" this if statement actually comapres??
2. Also what is the difference between PATH=$PATH:$1 & PATH=$1:$PATH
Here's my current regular expression(used in sed):sed 's///!Start.*//!End//g' in > outThe only problem being that the wildcard . does not work across multiple lines,
View 1 Replies View RelatedI have some mp3 files with the wrong date stamp on them. I need to change the month value to May, and the Day needs to be changed from 6 to 4. For some reason my mp3 recorder messed the datestamps up. The time part is fine. I have changed the first three files to the correct MMDD parts, using the following touch command:
Code:
[root@karsites 04-may]# touch -t 05040253 REC066.MP3
[root@karsites 04-may]# ls -l REC066*
[code]....
passing a wild card array to cp, I know it can be done but cant figure it out, ive got 3 files all start with the word somefile but have 3 different extensions
somefile.conf
somefile.dat
somefile.py
there in a folder with a bunch of other files and I just want to copy them to a different location. I remember is being something like cp somefile.[py conf dat] /somewhere but this isn't working Ive searched the net and can't find it with the keywords i'm using.
Can I dereference a wildcard in a command?For example if I want to create a file with the md5 hashes of compressed versions of files in a directory...gzip -rc ./source/* | md5sum -b - >> hash.txtThis above command gives me a file with one hash for the filename *I would like to get a file with the hashes and filenames for every file gzip compresses.
View 1 Replies View RelatedI would like help with modifying the following content:
toolbox/perl/man/man3/ExtUtils::Command.3::Command.3 differ
toolbox/perl/man/man3/ExtUtils::Command::MM.3::Command::MM.3 differ
I would like the content to be changed to:
toolbox/perl/man/man3/ExtUtils::Command.3
toolbox/perl/man/man3/ExtUtils::Command::MM.3
I was not sure how to tell sed what to look for? I tried the following but it did not work. sed -i 's/::* differ//g' mandiff.log
if I've missed this in the doc's, but I don't see the ability to "wildcard" blacklist for packages to _not_ be changed out via the slackpkg program.More specifically, I tagged all my packages like this:
mozilla-firefox-3.6b4-i486-1_OLDFOGIE.tgz
note the "OLDFOGIE" in my package name? So can something such as:
Quote:
*OLDFOGIE*
be put into slackpkg blacklist file?
I'm using Apache 2.2 to host multiple subdomains using a single SSL certificate (a wildcard certificate e.g. *.mydomain.com) and, yes, it works! Everything seems to be served correctly and the browsers are pretty happy.
And you can also have the non-SSL sites (virtual hosts on port 80) on the same IP. (That's covered elsewhere)
For those that want similar functionality here's my discovery...
My configuration is like this:
ssl.conf:
Code:
I would have to say that I don't believe that this will work if you are not using a wildcard SSL certificate and having anything other than subdomains under that wildcard.
It is somewhat limited in scenario where this is useful, but for a set of company websites that should be under SSL, this can be tremedously useful when you have a single IP.
I have 2 massive duplicate dirs of the same format as below:
dir1
subdir1
file1
subdir2
file1
subdir3
file1
...
Dir2 is the same, but it has some newer files of the same name. I want to copy all file1's from Dir2 to the same name and folders in dir1. So basically something like:
cp -pr bkpDir1/*/*-big.gif Dir2/*/*-big.gif
This works for singular cases:
cp -pr bkpDir1/uniquesubdir/*-big.gif Dir2/uniquesubdir/*-big.gif
But not for wildcards:
cp -pr bkpDir1/subdir*/*-big.gif Dir2/subdir*/*-big.gif
Anyway the aim is to do the first cp above, I have tried a few options using find. In trying to show an example stumbled upon a way that worked, while in dir2:
find */*-big.gif | xargs -i cp -rp {} ../dir1/{}
Sure there are better ways also...
I use this command:
Code:
find ./ -atime +360
to figure out the files that haven't been accessed since 360 days. The command above will return results like this:
Code:
/uploads/2010/02/some-file-name.ext
/uploads/2009/08/another-file-name.ext
... etc
I'm taking here about tins of directories, thousands of files. I'm looking to find a command that makes me able to move the results above to another path, and to create that path once it doesn't exist like below:
Code:
mv /uploads/2010/02/some-file-name.ext /old-files/uploads/2010/02/some-file-name.ext
But I want the executed command to create this path
Code:
/old-files/uploads/2010/02/
If it doesn't exist.
Java applet not loading image with relative path(e.g. images/1.jpg) but loads image with absolute path(i.e. from /root/user/images/1.jpg) . This is a problem when i want to host the applet on web server
View 2 Replies View RelatedI have a program that takes a relative path as input appends it to a some path string to get the actual path.
Now all I can input is the relative path. So if I want to go one level above my input will be ../mypath.
If I know the depth of the path used internally, I can use .. as many times to go to the root directory and then give the absolute path. But suppose I do not know the depth of the directory, can I construct a relative path string such that it considers it as a relative path. One way could be to have enough .. in the path string so that I can force an absolute path for some maximum depth of path.
Is there some path string syntax that I am not aware of but can achieve this?
Experimenting with shell variables, accidentally deleted the path variable how could I return to the original path value. What kinds of problems will I have if I don't have a path variable.
View 3 Replies View Relatedhow to add a path to PATH variable permanently so that it remains persisent even after closing shell and rebooting the system when i added a path, to variable it remained there as long as i didn't closed the shell. but when i reopened it ,changed were undone.
View 2 Replies View RelatedI have a path c:windowsackup I need this string to be changed into /windows/back/up I used the command -bash-3.00$ echo windackup | sed 's/\//g' but the output is windbackup
View 7 Replies View RelatedCurrent script:-
prefix=user@my-server:
find . -depth -type d -name .git -printf '%h�' | while read -d "" path ; do (
cd "$path" || exit $?
[code]....
How shall i go about changing the absolute path to relative path, so that /home/git/mirror/android/adb/ndk.git gets converted to /mirror/android/adb/ndk.git //echo <command> "$prefix$PWD.git" ?? - anything for relative path?
I am trying to figure out how i can add the path /usr/sbin/ into the $PATH variable. I want this to be used from the normal account. I am bored settinh this manualy each time my computer starts.
View 2 Replies View RelatedI have a requirement of using a wildcard certificate for 5 subdomains running under apache httpd server and 1 subdomain under tomcat.Is there any possibility of using the single wildcard certificate both in tomcat and apache
View 3 Replies View RelatedWhen I add some path in .bashrc by commenting out old path and adding new one like this:
#EXPORT HOME_PLAY=/home/gem/old_play
EXPORT HOME_PLAY=/home/gem/play
EXPORT PATH=$PATH:HOME_PLAY
After saving above changes, I enter the command: source ~/.bashrc Now if I do echo $PATH, the path shows both the old PLAY_HOME and new PLAY_HOME. This is really bad and messes up a lot of things in my project. This problem only goes away if I logout or reboot, a rather very long process. What is happening is that the old path is added to new path element and the old path includes the old path element you want to remove.