I am working in SunOS 5.10. When I login in system i have been given ksh shell.
What i am doing is that ?
I am changing shell to bash then I am creating 2 alias in command prompt like:
It is working fine in command prompt. But when kept these 2 cmds in shell script and executed it gives error like:
myalias.sh:
Scripts run successfully but when i tried to type:
bash-3.00$ deploy_dir
bash: deploy_dir: command not found
bash-3.00$ log_dir
bash: log_dir: command not found
Many thanks, it is resolved by your solution. I have question for my understanding..
1. using
means we are running script in same shell. Generally what should be right way to run script, in same shell or in parent shell?
2. If i need to run script usng bash then why can i not put . As i can see one the vendor provided script we have which start the tomcalt server using this entry...
we run that using ./starttomcat.sh..
1) When you have a script which contains commands like aliases or setting environment variables, we usually want them to get reflected in the current shell. In these cases, we use source. This is why always the profile files and aliases are run using the . or source.
2) If you put the shebang(#!/bin/bash) in the script, you are telling the OS to run the script using the shell mentioned in the first line (which in this case is bash). The moment this happens, your aliases are not going to work since this is not run in the same shell. Moreover, alias syntax is not the same across all shells. In case of your vendor script, it is just like any other shell script, not some shell specific settings, which is why the shebang line is present.
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)
I want to create an alias cpage4 and create a postscript file
For example I want to call
cpage4 file.f
which creates the file file.ps
I have written like this but don't know how to continue
alias cpage4 '/usr/bin/mpage -m40 -4AHP- \!* (6 Replies)
Hi guys,
I seek a solution for this action for Sun solaris.
find /sapmnt/${up}/global -prune -printf "%m %M %u %g %p\n" > $DAT1
The Application/Utilities in Sun Solaris are to old and cant understand
"-printf". An update for Application/Utilities is exist, but not possible to implement... (6 Replies)
Hi GUYS,
I need to create an alias for the the connect statement.
I want to replace "CONNECT TO DBNAME" to "CONNECT TO DBNAME user USERID using PASSWORD"
I thought i will add an alias in the .profile.
But its not working. May be because i am trying to create it for 3 words instead of one... (2 Replies)
Hey there,
I am starting a Computer Science Foundation year at the end of this month and am trying to get a little bit ahead of the game. I have always wanted to learn Unix and am currently struggling with creating a boot disc to run Solaris (I have chosen to study this) from as opposed to... (0 Replies)
If I want to create an alias called "cdr", and this alias need an argument (for example arg1)followed by "cdr", the result should go to the directory like "/home/ting/arg1/report/logs", the command should look like below,
alias cdr arg1 "cd /home/ting/\!$1/report/logs" (not working)::(
... (1 Reply)
Can i use the sun solaris 10 to create Fat32 partition ? and i have another question im so confused between format command an fdisk within it, and mkfs and newfs, well what i got is that i have to use format to create partition physcially in my hard disk then i have to use mkfs or newfs (which is a... (2 Replies)
I want to create an alias that will grep the passwd file for the logged in persons username and then it will return the password file entry. I want to pipe the whoami info to the grep command. I have created the following: % alias whopw grep... (1 Reply)