Skip to main content
Clarify
Source Link
Digger
  • 357
  • 5
  • 14

BASH SHELL; DEBIAN STRETCH

As seen here, I've created a "seems to work OK, most of the time" alias function for the su command (actually, I'm not able to find any problems with it...yet). I've inserted it into my /etc/bash.bashrc file.

function su() { if [[ $1 == "--" ]]; then command su "$@"; else command su -l "$@"; fi; }

However, I know it could probably stand some improvement.

(What I want this function to accomplish is rather simple. If I could use regular aliases, I'd want something like:

alias su='su -l AND alias 'su --'=su

However, I realize that the name of an alias can't have spaces...and the logic seems a bit circular...)

Does my shell function have any hidden traps? Will it negatively affect the operation of "su" if a different option is called (e.g. "su -m"c")?

BASH SHELL; DEBIAN STRETCH

As seen here, I've created a "seems to work OK, most of the time" alias function for the su command (actually, I'm not able to find any problems with it...yet). I've inserted it into my /etc/bash.bashrc file.

function su() { if [[ $1 == "--" ]]; then command su "$@"; else command su -l "$@"; fi; }

However, I know it could probably stand some improvement.

(What I want this function to accomplish is rather simple. If I could use regular aliases, I'd want something like:

alias su='su -l AND alias 'su --'=su

However, I realize that the name of an alias can't have spaces...and the logic seems a bit circular...)

Does my shell function have any hidden traps? Will it negatively affect the operation of "su" if a different option is called (e.g. "su -m")?

BASH SHELL; DEBIAN STRETCH

As seen here, I've created a "seems to work OK, most of the time" alias function for the su command (actually, I'm not able to find any problems with it...yet). I've inserted it into my /etc/bash.bashrc file.

function su() { if [[ $1 == "--" ]]; then command su "$@"; else command su -l "$@"; fi; }

However, I know it could probably stand some improvement.

(What I want this function to accomplish is rather simple. If I could use regular aliases, I'd want something like:

alias su='su -l AND alias 'su --'=su

However, I realize that the name of an alias can't have spaces...and the logic seems a bit circular...)

Does my shell function have any hidden traps? Will it negatively affect the operation of "su" if a different option is called (e.g. "su -c")?

Clarification
Source Link
Digger
  • 357
  • 5
  • 14

BASH SHELL; DEBIAN STRETCH

As seen here, I've created a "seems to work OK, most of the time" alias function for the su command (actually, I'm not able to find any problems with it...yet). I've inserted it into my /etc/bash.bashrc file.

function su() { if [[ $1 == "--" ]]; then command su "$@"; else command su -l "$@"; fi; }

However, I know it could probably stand some improvement.

(What I want this function to accomplish is rather simple. If I could use regular aliases, I'd want something like:

alias su='su -l AND alias 'su --'=su

However, I realize that the name of an alias can't have spaces...and the logic seems a bit circular...)

Does my shell function have any hidden traps? Will it negatively affect the operation of "su" if a different option is called (e.g. "su -m")?

BASH SHELL; DEBIAN STRETCH

As seen here, I've created a "seems to work OK, most of the time" alias function for the su command (actually, I'm not able to find any problems with it...yet). I've inserted it into my /etc/bash.bashrc file.

function su() { if [[ $1 == "--" ]]; then command su "$@"; else command su -l "$@"; fi; }

However, I know it could probably stand some improvement.

(What I want this function to accomplish is rather simple. If I could use regular aliases, I'd want something like:

alias su='su -l AND alias 'su --'=su

However, I realize that the name of an alias can't have spaces...and the logic seems a bit circular...)

Does my shell function have any hidden traps?

BASH SHELL; DEBIAN STRETCH

As seen here, I've created a "seems to work OK, most of the time" alias function for the su command (actually, I'm not able to find any problems with it...yet). I've inserted it into my /etc/bash.bashrc file.

function su() { if [[ $1 == "--" ]]; then command su "$@"; else command su -l "$@"; fi; }

However, I know it could probably stand some improvement.

(What I want this function to accomplish is rather simple. If I could use regular aliases, I'd want something like:

alias su='su -l AND alias 'su --'=su

However, I realize that the name of an alias can't have spaces...and the logic seems a bit circular...)

Does my shell function have any hidden traps? Will it negatively affect the operation of "su" if a different option is called (e.g. "su -m")?

Clarify
Source Link
Digger
  • 357
  • 5
  • 14

BASH SHELL; DEBIAN STRETCH

As seen here, I've created a "seems to work OK, most of the time" alias function for the su command (actually, I'm not able to find any problems with it...yet). I've inserted it into my /etc/bash.bashrc file.

function su() { if [[ $1 == "--" ]]; then command su "$@"; else command su -l "$@"; fi; }

However, I know it could probably stand some improvement.

What I desire is rather simple. I want something like:(What I want this function to accomplish is rather simple. If I could use regular aliases, I'd want something like:

alias su='su -l AND alias 'su --'=su

However, I realize that the name of an alias can't have spaces...and the logic seems a bit circular...However, I realize that the name of an alias can't have spaces...and the logic seems a bit circular...)

What am I missing?Does my shell function have any hidden traps?

BASH SHELL; DEBIAN STRETCH

As seen here, I've created a "seems to work OK, most of the time" alias function for the su command (actually, I'm not able to find any problems with it...yet). I've inserted it into my /etc/bash.bashrc file.

function su() { if [[ $1 == "--" ]]; then command su "$@"; else command su -l "$@"; fi; }

However, I know it could probably stand some improvement.

What I desire is rather simple. I want something like:

alias su='su -l AND alias 'su --'=su

However, I realize that the name of an alias can't have spaces...and the logic seems a bit circular...

What am I missing?

BASH SHELL; DEBIAN STRETCH

As seen here, I've created a "seems to work OK, most of the time" alias function for the su command (actually, I'm not able to find any problems with it...yet). I've inserted it into my /etc/bash.bashrc file.

function su() { if [[ $1 == "--" ]]; then command su "$@"; else command su -l "$@"; fi; }

However, I know it could probably stand some improvement.

(What I want this function to accomplish is rather simple. If I could use regular aliases, I'd want something like:

alias su='su -l AND alias 'su --'=su

However, I realize that the name of an alias can't have spaces...and the logic seems a bit circular...)

Does my shell function have any hidden traps?

Source Link
Digger
  • 357
  • 5
  • 14
Loading