New answers tagged

2

set an alias by adding your command in .bashrc file. alias abspath='sh /home/myuser/bin/abspath.sh' And don't forget to source the file.


4

This code is small enough that I would code it as a shell function: abspath() { echo "$(dirname "$(readlink -e "$1")")/$(basename "$1")" } And yes you do want all those quotes.


-1

A 3rd option is to create an alias called abspath that points to your abspath.sh script.


1

I would rename your bash script to abspath then move it to the bin directory. You'll be ablet to call abspath from anywhere then


27

You want to type abspath, but the program is named abspath.sh. The problem is not regarding whether it is in the PATH, but the fact that you are simply not using its name to call it. You have two options: Type abspath.sh instead. Rename the program to abspath.


0

So, I was able to solve this by re-compiling libc once more. I assume it must have been something in the toolchain, as I this time used a chroot being especially set to wheezy.


1

adding -v option solved my issue. The reason I am not sure.


0

If you want to get a single certificate out of a multi-certificate PEM bundle, try: $ openssl crl2pkcs7 -nocrl -certfile INPUT.PEM | \ openssl pkcs7 -print_certs | \ awk '/subject.*CN=host.domain.com/,/END CERTIFICATE/' The first two openssl commands will process a PEM file and and spit it back out with pre-pended "subject:" and "issuer:" lines ...


0

Please keep in mind that this answer is very, very Linux specific. parent_pid=$$ while [[ -z "${tty_bits-}" || $tty_bits -ne 0 ]]; do read initiator_name parent_pid tty_bits < <( awk '{ print substr($2, 2, length($2) - 2) " " $4 " " $7 }' /proc/$parent_pid/stat ) done echo $initiator_name This makes a key assumption: the login process ...


0

All of the other answers work if you are at the first level of login. But if, once login, you run 'su' or 'sudo' (in my case, to switch to a user account without shell for security reasons, I had to run: sudo su - <userid> -s /bin/bash -l), their solution fail. Following is a universal solution; using pstree, you check for sshd as a parent. if ...


0

I assume you are running ansible-playbook /blah/tasks/whatever.yml? If so, that's your problem. The proper structure for a playbook is: --- name: my playbook roles: - Arole - Brole # other playbok attributes tasks: - name: copy stuff copy: src=foo dest=bar - name: include cool tasks include: ../tasks/snafu.yml when: ...



Top 50 recent answers are included