Issues with setting Aliases


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Issues with setting Aliases
# 1  
Old 02-08-2016
Linux Issues with setting Aliases

Hi,

I have
Code:
set alias rm='rm -i'

and i m able to see that in the list of aliases.

however, when i fire the rm command the '-i' interactive flag does not seem to kick in.

I login to a free online terminal and then i say bash to set the bash profile.

Join

Here is the output uploaded:Image

Please suggest a solution or another online terminal that help me do this.

Last edited by vbe; 02-08-2016 at 04:26 AM..
# 2  
Old 02-08-2016
Cant see the output, but I dont understand, where did/do you set your rm alias, after beeing in the session?
# 3  
Old 02-08-2016
Sure you need the set? In my .profile, I have
Code:
        alias rm='rm -i'

# 4  
Old 02-08-2016
Linux

I dont find the .profile and i guess if you log onto the free online terminal you too would not be able to see it under your login.

I set the alias like this -> alias rm='rm -i' in the .bashrc and .bash_profile under my home directory.

I am also able to see rm=rm -i set as an alias under my profile; however, it does not seem to kick in.

You can try and let me know if your rm alias works... if so how on this online unix terminal -> Join

An looks like my snapshot image has been removed for some reason.
# 5  
Old 02-08-2016
Hi,

Try the following;

Code:
-bash-3.2$ alias rm="rm -i"
-bash-3.2$ rm test
rm: remove test (yes/no)? yes
-bash-3.2$

Regards

Gull04
# 6  
Old 02-08-2016
Linux

Quote:
Originally Posted by gull04
Hi,

Try the following;

Code:
-bash-3.2$ alias rm="rm -i"
-bash-3.2$ rm test
rm: remove test (yes/no)? yes
-bash-3.2$

Regards

Gull04
That suggestion made a lot of sense to me.

I did as you said Gull that works.

So the point is rm -rf does not prompt for confirmation while rm -r works and asks for confirmation. Also rm -irf also works.

Can anyone now explain why is this so and how to fix so that "-i" flag works with "-f" flag ?

Last edited by mohtashims; 02-08-2016 at 07:50 AM..
# 7  
Old 02-08-2016
Hi,

Could you post the output of the alias command?

Regards

Gull04
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Proxy Server

Samba on AIX, issues setting read-only flag on files?

Hello, I am having issues setting the "read-only" flag via Windows Explorer on my AIX Samba share... I have on my AIX 7.1 system installed Samba 3.6.24 and configured, joined to our Windows domain successfully. The samba binaries I got from perzl.org/aix In my smb.conf I have... ... (1 Reply)
Discussion started by: c3rb3rus
1 Replies

2. Solaris

Is there a difference between setting a user as nologin and setting it as a role?

Trying to figure out the best method of security for oracle user accounts. In Solaris 10 they are set as regular users but have nologin set forcing the dev's to login as themselves and then su to the oracle users. In Solaris11 we have the option of making it a role because RBAC is enabled but... (1 Reply)
Discussion started by: os2mac
1 Replies

3. UNIX for Advanced & Expert Users

Issues in setting up remote syslogging

Hello, I am using Ubuntu Linux and having problems in setting up remote syslogging. Appreciate your help on this. On the server unix host, I have made following changes. uncommented following lines in /etc/rsyslog.conf $ModLoad imudp $UDPServerRun 514 Now i am trying to run rsyslog in... (0 Replies)
Discussion started by: ravi.videla
0 Replies

4. Solaris

Help with beginner issues setting up ZFS??

Hi, I'm new to Solaris 11. The goal is to set up a ZFS raid-Z2 NAS. These are the instructions I've been trying to follow, with no luck: "Setting Up an OpenSolaris NAS Box: Father-Son Bonding" (not allowed to post URL) Issues: 1) Root access is evidently required but I don't... (8 Replies)
Discussion started by: lakedude
8 Replies

5. UNIX for Dummies Questions & Answers

Setting aliases

How come if I set an alias as such: alias dt 'date "+%Y-%m-%d %H:%M:%S"' it will work as intended, ie the command 'dt' does prompt the date and time, but not when invoked through a script as such: #!/bin/sh alias dt 'date "+%Y-%m-%d %H:%M:%S"' The OS is FreeBSD 7.1. Thanks in advance (4 Replies)
Discussion started by: figaro
4 Replies

6. Shell Programming and Scripting

etc aliases

Hello: i have several server with own etc aliases. right now i want to combine it all into a general etc aliases in a new freebsd server. cause it consist hundred thousand of record user inside how to make a shell script to combine it or configure it. all etc aliases record example: ... (0 Replies)
Discussion started by: peterLfs
0 Replies

7. UNIX for Dummies Questions & Answers

aliases

Is there a way to view what aliases are running on a given session? (1 Reply)
Discussion started by: BG_JrAdmin
1 Replies

8. Programming

aliases

Hi. I have a C program that is using the **environ pointer and I am trying to set up aliases for a system("/bin/ksh") call. This works for other environment variables but not for the aliases. Does anyone know if this can be done? Thanks ahead of time. (1 Reply)
Discussion started by: mluey61
1 Replies
Login or Register to Ask a Question