problem in creating execute profile file in unix


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting problem in creating execute profile file in unix
# 1  
Old 02-03-2012
Question problem in creating execute profile file in unix

first i created a profile file(my_var.profile) which contains
Code:
export my_var=20

after that i created shell scripts(my_var.sh) which contains
Code:
#!/bin/bash
. ./my_var.profile
echo '$my_var='$my_var

but when i am executing sh my_var.sh it is showing error that no such file/directory .profile.


Moderator's Comments:
Mod Comment Please use next time code tags for your code and data

Last edited by vbe; 02-03-2012 at 02:07 PM..
# 2  
Old 02-03-2012
correct as below
Code:
./my_var.profile
echo "my_var=$my_var"

# 3  
Old 02-04-2012
again it is showing same error no such file or directory.profile
# 4  
Old 02-04-2012
Try sh ./my_var.sh
# 5  
Old 02-04-2012
snapshot of error message

https://picasaweb.google.com/1054632...eat=directlink

Last edited by Scott; 02-04-2012 at 05:29 PM.. Reason: Removed broken IMG links
# 6  
Old 02-04-2012
I noticed you are using cygwin. Can it be that your files have been created in dos format and they end with carriage return-line feed. If so your second file is trying to source ./my_var.profile<CR>, which would also account for the strange error message (after a carriage return it writes on the same line). I would remove the CR characters (for example by a dos to unix command) and try again..
This User Gave Thanks to Scrutinizer For This Post:
# 7  
Old 02-05-2012
give full permission for the file i.e
Code:
chmod 777 my_var.profile

and run using
Code:
sh my_var.sh

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Where to see my .profile file in UNIX?

Hi where to see my .profile file in unix thanks Dharma (2 Replies)
Discussion started by: na.dharma
2 Replies

2. Homework & Coursework Questions

Creating a .profile, displaying system variables, and creating an alias

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Here is what I am supposed to do, word for word from my assignment page: 1. Create/modify and print a... (2 Replies)
Discussion started by: Jagst3r21
2 Replies

3. Shell Programming and Scripting

problem in creating my own profile file in unix

I am new in shell scripting. currently i am using cygwin. My problem is i created a profile file in my own folder. file name is first.profile in which i gave following values to variable export a=10 now i am executing this profile file by below command ./.first.profile it executed... (4 Replies)
Discussion started by: pratikjain998
4 Replies

4. UNIX for Dummies Questions & Answers

Help creating new .profile

Hi, We have a load of users which point to the same basic profile by a link: .profile -> /export/home/dusers/INIT/dot.profile I'd like to create a seperate profile for one user -testu12. If I remove the link from his profile will it delete the actual dot.profile file? I've tried to do a... (4 Replies)
Discussion started by: Grueben
4 Replies

5. Shell Programming and Scripting

how to execute ksh simple shell script without creating .sh file

please help me to execute a simple shell script like for i in `ls echo $i done . i dont want to create a new sh file to execute it. Can i just type and execute it ? because I always this kind of simple for loops . Please help . Thanks (7 Replies)
Discussion started by: Sooraj_Linux
7 Replies

6. Shell Programming and Scripting

How to force Xmanager to execute .profile?

hello all i created a login scrip and add it successfully to .profile now i need to force this .profile to be executed if the user login using xmanager not a normal telnet best regards ---------- Post updated at 09:05 AM ---------- Previous update was at 03:25 AM ---------- Ant updates ???? (10 Replies)
Discussion started by: islam.said
10 Replies

7. Shell Programming and Scripting

Creating a .sh script to execute an SQL file

Hello I'm hoping someone may be able to help. I'm absolutely brand new to these shell scripts and have tried to bash bits together from the little learnt but my final script still doesn't work. Sorry if something similar is already posted but couldn't find anything existing close enough to help... (1 Reply)
Discussion started by: Dan27
1 Replies

8. Shell Programming and Scripting

Profile File in Unix

Hi, I have to run a sqr program. In the profile file everything is set. e.g APPLID=personel APPPATH=/${ENVIRONMENT}/${APPPATH} and so on.. SQRDIR=/opt/sqr/bin/syb Still when I'm running this script,its giving error APPLID not set and SQRDIR not set. Any idea,why? TIA (5 Replies)
Discussion started by: autosys_nm
5 Replies

9. UNIX for Advanced & Expert Users

Problem in updating .profile file in HP-UX B.11.00 machine

Hello All, I am using a HP-UX machine and I want to update the .profile file so that after login to my userID that will be applicable to my ID also. What I am trying to do is : In .profile file I am trying to write in /home/userID folder: export PATH=$PATH:$HOME:. so that whenever I will... (3 Replies)
Discussion started by: abhishek0071
3 Replies

10. UNIX for Dummies Questions & Answers

not able to execute .profile /.kshrc

Hi, I m new to Solaris CDE...earlier i was using Windows. Here is my problem.. i know that whatever the initial settings we need to execute,we can place them in .profile file. in my home dir (/home/venki),i have following files for that. .profile .profile.user .kshrc .kshrc.user ... (2 Replies)
Discussion started by: Venky
2 Replies
Login or Register to Ask a Question