Defining an alias FreeBSD


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Defining an alias FreeBSD
# 1  
Old 08-14-2010
Defining an alias FreeBSD

I have defined this alias as quick way to find out which mount point to use for a USB drive after inserting it:
Code:
# alias da='dmesg | grep da | grep MB'

However, when invoking it, it states the following:
Code:
# da
da: Command not found.

Can someone explain what is the issue here and how it can be resolved?
# 2  
Old 08-14-2010
What is your shell?
# 3  
Old 08-14-2010
Given FreeBSD and the # prompt which I take to be that you were logged in as root, Im assuming that you're running under csh/tcsh (the shell assigned to root by default when you install FreeBSD).

I was able to reproduce the problem, but only under FreeBSD (bugger is the host name)

Code:
bugger# alias foo="echo bar"
bugger# foo
foo: Command not found.
bugger# csh --version
tcsh 6.14.00 (Astron) 2005-03-25 (i386-intel-FreeBSD) options wide,nls,dl,al,kan,rh,color,filec

When I try this with csh on a linux host it works fine. The version on linux is more recent, so this could just be a csh bug. I don't use csh, so unfortunately the only things I can offer are:

1) switch the login shell for root in /etc/password to ksh or bash.

2) check the version of csh on your host, and if its out of date with the FreeBSD ports collection upgrade it. No assurance that an upgrade will fix it, but it'd be worth the try if you want/need to use csh over ksh.

The version on my linux host is:
tcsh 6.15.00 (Astron) 2007-03-03 (i586-suse-linux) options wide,nls,lf,dl,al,kan,sm,color,filec

Hope this was of some use.
# 4  
Old 08-14-2010
SOLVED:
The equal sign (=) should be removed. The command now is:
Code:
alias da 'dmesg | grep da | grep MB'

This User Gave Thanks to figaro For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Defining variable problem

Hi I'd say I'm having this weird problem where my script isn't taking the value off a variable or printing it. My code is like this: set count_C= `grep -c C mols` set count_H= `grep -c H mols` set count_O= `grep -c O mols` sed -i '7,7 s/$/ $count_C $count_O $count_H/g' input It... (8 Replies)
Discussion started by: saleheen
8 Replies

2. UNIX for Dummies Questions & Answers

Create alias files (not alias commands)

If one: $ find -name 'some expression' -type f > newfile and then subsequently wants to create an alias file from each pathname the find command retrieved and the > placed within 'newfile', how would one do this? Ideally, the newly created alias files would all be in one directory. I am... (3 Replies)
Discussion started by: Alexander4444
3 Replies

3. BSD

FreeBSD - Wireles Ad-hoc Networking with IP alias

Hello Friends, I'm a newbie to FreeBSD. Trying to implement a IEEE paper : Energy consumption models for ad-hoc terminals (Computers). The test setup with 3 Computers & Wireless NIC goes as follows: Transmitter (A) --------------- Forwarder (B) -------------- Receiver (C) 10.0.1.1/24 ... (0 Replies)
Discussion started by: Govindaraj
0 Replies

4. UNIX for Dummies Questions & Answers

Help with defining PATH

Hi All, I have a trivial question but I dont know how to solve it. So basically I'm working on a USB key and I have a directory with some scripts which I use to work on files present in other directories within the USB or sometimes on the main harddisk too. The problem is every time I have to... (3 Replies)
Discussion started by: pawannoel
3 Replies

5. UNIX for Dummies Questions & Answers

defining variable in .profile

In root dir i have created a .profile file and added variable and assigned a path to it: a = '/dir/dir' export a but when i echo (echo $a) the path or use this variable the value or path not getting displayed. i tried executing the .profile and logging out and logging in, didnt workout. am... (1 Reply)
Discussion started by: abhi_n123
1 Replies

6. Shell Programming and Scripting

alias defining problem in .cshrc file

Hi folks, I'm trying to define the following command as alias in .cshrc file: ls -ltr | grep ^d | awk '{print $9}' | xargs du -hs I defined it as the following: alias nirdirs '`ls -ltr | grep "^d" | awk "{print \\$9}" | xargs du -hs`' I've got the following error when I've run the alias:... (7 Replies)
Discussion started by: nir_s
7 Replies

7. Programming

Application crashes in FreeBSD 7.1 while working ok in FreeBSD 6.3

Hello there, My mulithreaded application (which is too large to represent the source code here) is crashing after installing FreeBSD 7.1-RELEASE/amd64. It worked properly on others machines (Dual Cores with 4GB of RAM - FreeBSD 6.2-RELEASE/i386). The current machine has 2x Core 2 Duo... (1 Reply)
Discussion started by: Seenquev
1 Replies

8. Shell Programming and Scripting

defining variables

Hey all, I was wondering if someone would take a look at this script I'm working on. I don't know if i have the syntax correct for my variables and if the for loop is written correctly. any assistance would be greatly appreciated. #!/usr/bin/bash ###########################################... (12 Replies)
Discussion started by: em23
12 Replies

9. AIX

defining a printer in qconfig

I've got a modified samba script (named it winprint) that I can use to print out to a to a shared Win Network printer from an AIX machine. This is a modification of the samba provided smbprint script changed to work under AIX as the backend for a queue. It does not read a config file I can print... (0 Replies)
Discussion started by: matheeq
0 Replies

10. UNIX for Dummies Questions & Answers

Defining Variables

I'm trying to define a variable named sin I already have a variable named cos, which has the value "hello" I want sin to have the value of "hellothere", so sin would be something like sin = $cos & "there" but I'm not sure that I know the syntax. Can anyone help? :confused: (4 Replies)
Discussion started by: sailorliones
4 Replies
Login or Register to Ask a Question