alias problem


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers alias problem
# 1  
Old 10-17-2006
alias problem

How can I get two commands in one alias?
In my exaple it only display the current date.

Code:
alias two='cal | date'

# 2  
Old 10-17-2006
'cal | date' seems to be correct. output of cal command is piped to date command. Is this what you wanted to do? Or something else?

the alias works fine for me
# 3  
Old 10-17-2006
Your syntax looks correct, but what is "cal | date" supposed to do?
# 4  
Old 10-17-2006
I want to first show a calendar and then show the date.
Is that something I can do with a pipe, or am I totaly wrong??
# 5  
Old 10-17-2006
No pipe is necessary for that. Try
Code:
alias datecal='cal; date'

Code:
October 2006             
 S  M Tu  W Th  F  S        
 1  2  3  4  5  6  7        
 8  9 10 11 12 13 14        
15 16 17 18 19 20 21        
22 23 24 25 26 27 28        
29 30 31                    
                            
Tue Oct 17 10:52:42 EDT 2006

# 6  
Old 10-17-2006
Perfect, just what I was looking for.. Thankīs
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Facing problem with Alias created through script.

Hi Guru's, I am creating alias for db instance running on a server through script, am able to create them based on /etc/oratab entries and can use successfully with the below script. #!/bin/bash SCRIPT_PATH=${HOME}/scripts/db/script... (3 Replies)
Discussion started by: venky.b5
3 Replies

2. Shell Programming and Scripting

Alias problem

Please forgive me if this is too stupid a question as I am fairly new to scripting. I have an alias in my .profile (ksh) like this: alias ff='find . -name $1' The idea is to find all files in current dir and all subdir with the name specified in the param passed. So, I issue the command:... (8 Replies)
Discussion started by: sssccc
8 Replies

3. Red Hat

alias ip problem,i canīt find out solution

hi, we have eth1; in the beginning it was proposed to create from eth1, eth1.2500 and eth1.240. It did not worked cause vlan 1.2500 was not tagged in the switch. so they decided to leave eth1 like a physical interface with eth1.2500 config (removel vlan tag) and create eth1.240 but it did... (0 Replies)
Discussion started by: pabloli150
0 Replies

4. 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

5. Shell Programming and Scripting

Alias problem with awk command

Hi to all, I'm facing some problems when adding an alias like: #alias list="ls -al | awk '{ print $1, $2, $3, $4, (($5/1048576))"\t", $6, $7, $8, $9 }'" and when I enter: #list I get: Syntax Error The source line is 1. The error context is { print >>> , <<< awk:... (3 Replies)
Discussion started by: enux
3 Replies

6. Linux

mail alias problem

Hi all, well i am configuring backuppc for awhile, anyway my current problem is, i set a smarthost, configured the mail to use our ISP smtp server, and its working successfully thanks to ALLAH, now i want to set an alias for mails( it was working when it was using the local smtp server), so the... (0 Replies)
Discussion started by: XP_2600
0 Replies

7. 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

8. OS X (Apple)

Problem using a top command alias in my profile

Hi- I am newish to the mac osx unix interface. I want to set up top so that it always displays the username. I can use this command to do this: top -ocpu -P ' PID COMMAND %CPU TIME #TH #PRTS #MREGS RPRVT RSHRD RSIZE VSIZE USER' -p '$aaaa ^bbbbbbbbb $cccc $wwwwwww $ee... (1 Reply)
Discussion started by: mikey11415
1 Replies

9. Shell Programming and Scripting

Problem with alias and invisible text

okay how do i make an alias that has a space in it? for most of my other ones i've simply done within my ~/.bash_profile alias `ls`='ls -laF' but with alias `sudo su`='sh hello.sh' I'm unable to make it work in addition i was wondering how i could allow the user to type in... (1 Reply)
Discussion started by: cleansing_flame
1 Replies

10. UNIX for Dummies Questions & Answers

Alias problem

i'm trying to get the alias alias "sudo su"=`sh script.sh` whats wrong with this and how can i make an alias that has a space in it (1 Reply)
Discussion started by: cleansing_flame
1 Replies
Login or Register to Ask a Question