Tag Info

Hot answers tagged

4

I was installing RVM on a remote server today and had the same issue. It seems that the installation was not executed by default. This is what I did to solve it: curl -L https://get.rvm.io | bash -s stable # In case rvm not found cd ~/.rvm/archives tar xvzf rvm-1.26.0.tgz # or whatever RVM version you have cd mpapis-rvm-xxxxxxx ./install cd .. ...


3

If you think it's that file that's responsible, you could reset it back to the packaged defaults by reinstalling the bash-completion package. We have to be a little more forceful to get it to copy the configuration back, but this should work: sudo rm /etc/profile.d/bash_completion.sh sudo apt-get -o Dpkg::Options::="--force-confmiss" install --reinstall ...


3

Your usage of ls and grep is correct, that will find any results in the ls output containing 'stomething'. Note that looks at the whole line, not just the filename (mostly applicable when using certain flags with ls, such as ls -l etc). Finding directories, you're better off using find and wc (wordcount): find /home/mydir -maxdepth 1 -mindepth 1 -type d | ...


3

First MD5 is a hash function that reads the whole file/string/input data and generates a defaultly 128-bit long hex-formatted hash. That hash is always the same when the file or the given string is the same. With the utillity md5pass you do exactly the same, but the hash gets "salted". In cryptography, a "salt" is random data that is used as an additional ...


3

If $dec has no value, you're doing ls "". Try it and you'll see you get the same error message. Note ls "" is NOT the same as ls (without arguments). Check your script to see why $dec is not defined. If, as you say, $dec is defined before you run the script, you probably need to export it so it's known to scripts you run. export dec ./script.sh Read this ...


2

create a file and put smth like #!/bin/bash useradd "$1" && gpasswd -a "$1" group in there.


2

Your question is a bit vague because you haven't really said what you need this for. I'm assuming you need arguments as well so first create the script, so in the terminal type nano scriptname.sh and past in the script below. #!/bin/bash #$1 username #$2 home directory useradd $1 -U -m -d $2 If you type 'man useradd' you will see that -U creates a ...


2

Works with gawk or nawk, but not mawk. awk -F '[[:blank:]]*:[[:blank:]]*' ' BEGIN {print "<table><thead><tr><th>Name</th><th>Age</th><th>Tagid</th></tr></thead><tbody>"} { name = $2; getline age = $2; getline tagid = $2 print ...


2

Through single awk command I think it would be faster than using a while-loop. You can test it how fast is by time command in front of the command and see if it's fast ;) awk -F, 'NR==FNR{ a[$2]=$2$1;next } NF{ print $0 ((a[$2]==$2$3)?",ok":",nok") }' dif.txt data.txt d1,40,gold,ok d2,30,silver,ok d3,20,bronze,ok d4,10,iron,ok d5,5,wood,ok d6,20,gold,nok ...


2

You are correct that set is a shell builtin: that means that its documentation is in the manual page for bash (in the SHELL BUILTIN COMMANDS section) rather than in a manpage of its own. More simply, you can get basic usage information by typing help set from the shell prompt. As to using it to "find out all directories in your path" it would be useful to ...


2

sudo su executes su as if you were the root user. That means, the shell that is opened is the shell given in the entry of the user in /etc/passwd in the 6th field. In case of your systems root user it might be /bin/fish. That shell is executed as login shell, so the rc-scripts of the root user are executed. When you execute sudo fish, then the application ...


1

sudo su su - change user ID or become superuser sudo bash bash - GNU Bourne-Again SHell sudo fish fish - is a smart and user-friendly command line shell for OS X, Linux, and the rest of the family. http://en.wikipedia.org/wiki/Unix_shell#Shell_categories Bourne-Again shell (bash) and Friendly interactive shell (fish) both are shell types.


1

There is a manual entry for set: the one derived from the POSIX standard's specification of set. To view it, you must have manpages-posix-dev installed (well, manpages-posix would do, but you might as well install both). Then you can do: man 1posix set Or visit the online Ubuntu manpage: http://manpages.ubuntu.com/set.1posix When possible, do prefer the ...


1

Your filename actually contains both a carriage return and a newline. bash parameter expansion can handle this: $ filename=$'attachment;\r\nJobRunStatisticsReport_20150122.zip' $ echo "$filename" attachment; JobRunStatisticsReport_20150122.zip $ shopt -s extglob $ echo "${filename##attachment;*([[:space:]])}" JobRunStatisticsReport_20150122.zip Does not ...


1

That's pretty close to a glob pattern. Try if [[ "$path/$file" == *.{txt,doc,docx,xlsx,rtf} ]]; If you really want a regular expression if [[ "$path/$file" =~ \.(txt|doc|docx|xlsx|rtf)$ ]]; Finding a regular expression tutorial online left as an exercise ...


1

The tilde is not expanded when in quotes -- ref: https://www.gnu.org/software/bash/manual/bashref.html#Tilde-Expansion So you want to remove the quotes: str_getIdle_exe=~/Documents/Seb/Prjcts/Idle/getidle/src/getIdle If the path under your homedir contains a space, just leave the tilde unquoted: some_path=~/"dir with spaces/file with spaces"


1

It works for me: reut@HP-EliteBook-8470p:~$ which lesspipe /usr/bin/lesspipe How to fix anyway? Short answer - make sure the following line is in /etc/environment: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/your/specific/folder" Notice the last folder is a specific folder you want to add. The ...


1

It tests whether the file "/etc/debian_version" exists and is a regular file.


1

We can do better, we can do a range check to make sure it's between 1 and 12 inclusively. There are about a billion ways of doing this but here are a couple: if [ "$v" -ge 1 -a "$v" -le 12 ]; then cal -m "$v" else cal fi Or use an arithmetic test: ((v>=1 && v<=12)) && cal -m "$v" || cal


1

You need to actually run the file: Make sure the file is executable (you can learn more about file permissions here). If gcc succeeds in linking it should already be executable (thanks @steeldriver): chmod +x remvocals Execute the file: ./remvocals



Only top voted, non community-wiki answers of a minimum length are eligible