Alias in bash not working [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
alias bp="cat $# > $#.BACK"
My second idea was:
alias bp="cp $#{,.BACK}"
So i want to have a command to backup a file.
It does not raise any error but it simply doesn't work.

Aliases are purely a textual replacement. If you want to use or manipulate the arguments, you need to create a function:
bp () {
for file; do
cp -i "$file" "$file".BACK
done
}

Related

Accidental echo [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
When I was setting up my Ubuntu environment, I think I mistyped and did something like this:
echo 'srouce /opt/whatever'
And now when I open terminal, the first line is always:
srouce: command not found
How can I get fix this issue?
Fix the misspelling in your shell startup files:
sed -i 's/srouce/source/' .bashrc .profile

Delete file with # in Linux [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I want to delete a #tem.txt# called # that for some reason using emacs appeared
is between two # and I have not been able to remove it using rm, rm -f, unlink
See my file
Since '#' is a special character, you can try rm \#tem.txt\#

Unix rename command for one character on filename [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I have over 1,000 files that I will like to change one character on the filename, Ex: GM001001, GM001002, GM001003, etc.. to be rename to GX001001, GX001002, GX001003, etc... As you can see the common denominator will be the M to be replace for an X.
You can combine mv with string replace to achieve this:
for f in $(ls)
do
mv $f ${f/GM/GX}
done

Error while trying to copy file to many files using cp [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
Error when running this command, i think the command is clear to get the idea.
cp file.txt /folder/*/*/*/file.txt
You need a loop to do that:
for dir in /folder/*/*/*/; do cp file.txt "$dir"; done

Add a number to the beginning of every-line in a .lst file [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
So I used "shuf" to make a word-list, The problem is when I run the command shuf -i 0500000000-0599999999 -o passwords.lst it doesn't type the first number which is '0' so I want a command to type that '0' into the beginning of every-line, if it's not possible with shuf any command will help.
This piped command will simply prepend a zero:
shuf -i 0500000000-0599999999|sed s/^/0/ > passwords.lst

Resources