Sponsored Content
Full Discussion: Source Command
Top Forums Shell Programming and Scripting Source Command Post 302519347 by NelsonC on Tuesday 3rd of May 2011 06:25:01 PM
Old 05-03-2011
Source Command

Hello,

I have created a script that changes directories but in order for it to work I always need to invoke a source ./script

Here is a copy of my script.. if I do not invoke "source ./script" the change directory command does not work.

Any ideas?

//

The script is pretty basic
Code:
#!/usr/bin/bash
SYSLOG=/home/xxx
clear
echo ""
echo "Launch script using (Source ./team_d_menu)"
echo -e "\nTeam D Rules Menu\n"

echo "a Go to Syslog Rules"
echo "b Restart Syslog"
echo "c Copy DATA to NCOLOG"
echo "d Tail Syslog.log (Code Check)"
echo "e Restart SYSLOG Probe"

echo -e

echo -n "Enter a,b,c,d,e:"

read answer

echo

#
case "$answer" in

        a)
        cd $SYSLOG
        ;;

        b)
        ;;

        c)
        ;;

        d)
        ;;

        e)
        ;;

        *)
                echo "no selection"
esac


Last edited by Scott; 05-03-2011 at 07:29 PM.. Reason: Code tags...
 

9 More Discussions You Might Find Interesting

1. Programming

ls command source code

Hi all, I want to know how ls was implemented in linux.; How to view the source code? filename/sitename...? thanks (1 Reply)
Discussion started by: linuxer_rh
1 Replies

2. Shell Programming and Scripting

problem with source command

Ive written a script that uses the source command but i get the error: source: not found when i enter it myself manually it works fine, is there any reason I cannot use this command in a script? (2 Replies)
Discussion started by: jonbyrne123
2 Replies

3. UNIX for Dummies Questions & Answers

how to install "source" command!/ broken "login.cl"!

Hello, I am new to this forums and this is my first "asking help" message! i have 2 problems: 1- for unknown reasons the "source" command is not avalable in my system (UBUNTU). i can't either see it in my bin directory! 2- again for unknown reasons the "login.cl" file in the home... (0 Replies)
Discussion started by: astrosona
0 Replies

4. UNIX for Dummies Questions & Answers

Trouble with the Source command..

Hi everyone, I've been writing a script as an assignment which essentially does the exact same thing as the tree -d function (bash shell btw), except next to every directory name it gives a number which you can input into the same command in order to change the current working directory to the... (1 Reply)
Discussion started by: petey22uk
1 Replies

5. Shell Programming and Scripting

Any command to delete files from source dir after SFTP copy

Hi, I am currently using SFTP 'put' command to copy all files to remote server and then delete the copied files from source directory. Can anyone help me with a single command to copy and remove files in one go? Thanks and Regards, Chetan Vyas (5 Replies)
Discussion started by: chetancrsp18
5 Replies

6. Programming

Source Command in Unix

Hi all, I am having two files, the content of first file (out.bash) is #!/bin/bash cd /home/jessy/abc echo "hihi-part1" Second file content (out2.csh)is #!/usr/bin/csh source ./out.bash echo "hihi-part2" When I run in Ubuntu, i am typing bash out2.csh, the output display is... (7 Replies)
Discussion started by: jessy83
7 Replies

7. Shell Programming and Scripting

Awk command with two source files

Hello, I have two source files: sourcefile1.dat: 12345 xxx yyy zzz 23456 qqq ttt rrr 34567 ppp jjj ggg 45678 fff ddd sss 56789 nnn mmm ccc sourcefile2.dat: 12345.gif 34567.gif I want to obtain a simple awk one linger to obtain the following: xxx yyy zzz 12345.gif qqq ttt rrr... (15 Replies)
Discussion started by: palex
15 Replies

8. Shell Programming and Scripting

Source command returns error when it strikes conditional statement "ifeq"

Hello All, I am running source command on my project configuration file app.cfg which has conditional statements with make file systax E.g ifeq ($(APP_CMP_DIR),trunk). When I source this file it throws error: syntax error near unexpected token... (1 Reply)
Discussion started by: anand.shah
1 Replies

9. Shell Programming and Scripting

Ps command source.

Dear friends, I am using SCO Openserver 5.0.7. Where does the ps -ef command pick the information from? Is it stored in some file? Also, the ps -ef command or the ps -eo args command displays truncated information. How to get the complete expanded output without truncation? Thanks in... (8 Replies)
Discussion started by: sabu
8 Replies
service(8)						      System Manager's Manual							service(8)

NAME
service - run a System V init script SYNOPSIS
service SCRIPT COMMAND [OPTIONS] service --status-all service --help | -h | --version DESCRIPTION
service runs a System V init script in as predictable environment as possible, removing most environment variables and with current working directory set to /. The SCRIPT parameter specifies a System V init script, located in /etc/init.d/SCRIPT. The supported values of COMMAND depend on the invoked script, service passes COMMAND and OPTIONS it to the init script unmodified. All scripts should support at least the start and stop commands. As a special case, if COMMAND is --full-restart, the script is run twice, first with the stop command, then with the start command. service --status-all runs all init scripts, in alphabetical order, with the status command. EXIT CODES
service calls the init script and returns the status returned by it. FILES
/etc/init.d The directory containing System V init scripts. ENVIRONMENT
LANG, TERM The only environment variables passed to the init scripts. SEE ALSO
/etc/init.d/skeleton, update-rc.d(8), init(8), invoke-rc.d(8). Jan 2006 service(8)
All times are GMT -4. The time now is 10:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy