Sponsored Content
Full Discussion: Linux script - Crazy results
Top Forums Shell Programming and Scripting Linux script - Crazy results Post 302337650 by imprimisxo on Friday 24th of July 2009 02:43:24 PM
Old 07-24-2009
When I run it as BASH it gives different (but still undesired) results.

Code:
Code:
>cat exec_move_yesterday_files_from_incoming.sh
#
# Capture the current directory.
export -p CurrentDir="`pwd`"
echo $CurrentDir
#
# Capture the new directory name in the form YYYYMMDD.
export -p DateDir="`date +"%Y%m%d"`"
echo $DateDir
#
# Store the desired target directory.
export -p TargetDir="/staging/VCproc/TestIncoming"
echo $TargetDir
#
# Create the directory to move yesterday's file to.
cd $TargetDir
#mkdir $DateDir
`pwd`
#
#
cd $CurrentDir
`pwd`


Results:
Code:
VCproc@mpslx093[client]/staging/VCproc/application/dm
>bash exec_move_yesterday_files_from_incoming.sh
/staging/VCproc/application/dm
20090724
/staging/VCproc/TestIncoming
: No such file or directoryrom_incoming.sh: line 15: cd: /staging/VCproc/TestIncoming
: No such file or directoryrom_incoming.sh: line 17: /staging/VCproc/application/dm
: No such file or directoryrom_incoming.sh: line 20: cd: /staging/VCproc/application/dm
: No such file or directoryrom_incoming.sh: line 21: /staging/VCproc/application/dm

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Oh no!! crazy script

Hi Could be stupid, but I can figure out... I have a script that downloads a file from a http server ( virus definitions file ). The thing is that when I run it from the console (bash) works fine, but when I put it in the root's cron it doesn't, and it generates a core file. example: ... (8 Replies)
Discussion started by: piltrafa
8 Replies

2. Linux

How I will check wheather my linux benchmark results are OK

My system bench mark results INDEX VALUES TEST BASELINE RESULT INDEX Arithmetic Test (type = double) 2541.7 876123.7 344.7 Dhrystone 2 without register variables 22366.3 5411602.3 ... (1 Reply)
Discussion started by: chandra s
1 Replies

3. Linux Benchmarks

Results for Linux Benchmarks

Hi, I was trying to build Linux Benchmarks with latest Intel C++ Compiler. When I used -ipo (inter-procedural optimization) option, arithmetic test (arith.c) failed on execution. The problem is Intel compiler's advanced optimization option (-ipo) optimizes much more than expected and this... (50 Replies)
Discussion started by: cpjain
50 Replies

4. Shell Programming and Scripting

PERL cgi script... extra character driving me crazy

I'm using a PERL cgi script that uses rrdtool to make graphs. I can't get the syntax correct to use a degree sign (alt+0176 like this °) and also using a variable. If I use single quotes, I can't call the variable. If I use double quotes, there is an extra symbol (Â) before the ° which goes... (2 Replies)
Discussion started by: audiophile
2 Replies

5. Red Hat

Linux ls -L Results

I seem to be somewhat baffled by the results of the -L option of the ls command on our new Linux system. I have a symbolic link defined like the following: ptmawpmfld.sqr as /u21/xxxx/m/moranp1/yyyy/fixpaths/tests20091218/awpmfld.sqr When I issue the command ls -l ptmawpmfld.sqr, I see the... (2 Replies)
Discussion started by: ptmoran
2 Replies

6. Shell Programming and Scripting

Print some results in a text file using script in linux

hello everyone, i really need your help to write a script which would just print following kind of result into a text file (result.txt) XYZ test Results ID: <unique-id> Date: <date> ------------------------------------------------- | Task | Result | Time |... (3 Replies)
Discussion started by: viriimind
3 Replies

7. UNIX for Dummies Questions & Answers

UNIX/Linux/Distributions - driving me crazy...

Hello there, first of all: I do not want to become a hacker. you cannot do that. you cannot learn that from a book. Don't think I'm some kind of a script-kiddie. now that's settled let's start. I've been trying around with a lot of OS lately. I have backtrack5 installed on my notebook,... (10 Replies)
Discussion started by: Dr. Nick
10 Replies

8. UNIX for Dummies Questions & Answers

LINUX SORT command chops results

I am trying to sort a file . The file looks like this: DDFF 2 /ztpfrepos/pgr/load DDFQ 2 /ztpfrepos/pgr/load DDFX 2 /ztpfrepos/pgr/load DDUA 2 /ztpfrepos/pgr/load My command: sort -k1 /home/c153507/Bin/OPL1.txt -o /home/c153507/Bin/OPL1.txt The results are OK except for one line where... (4 Replies)
Discussion started by: Yahalom
4 Replies

9. Shell Programming and Scripting

How to Assign SQL Query Results to Variables in Linux?

Hi, I am new to linux... How to Assign SQL Query Results to Variables in Linux,i want ti generate it in param files, Can anyone please explain me. Ex: SQL> Select * from EMP; O/P: Emp_No Emp_Name 1 AAA 2 BBB 3 CCC and I want expected... (5 Replies)
Discussion started by: Sravana Kumar
5 Replies

10. Shell Programming and Scripting

Script to Run Multiple Systems Checks and mail me the results after every reboot- Linux

Hello, I'm trying to create a mechanism wherein a set of Production servers will email me the results of system checks like Uptime, NFS Mounts and a Process after every scheduled reboot. For this, I figured I'd use the @reboot parameter that crond comes with. I have added the below onliner... (3 Replies)
Discussion started by: pocodot
3 Replies
slack(8)						      System Manager's Manual							  slack(8)

NAME
slack - Sysadmin's lazy autoconfiguration kit SYNOPSIS
slack [option ...] [role ...] DESCRIPTION
slack is a master command which coordinates the activities of its backends, which variously: o determine the list of roles to be installed on this server o create a local cached copy of the role files from the central repository o merge file trees from subroles into a single, unified tree o install files onto the local filesystem o run scripts before and after installation Options you give to slack will be generally passed along to the backends where relevant. OPTIONS
-h, --help Print a usage statement. --version Print the version and exit. -v, --verbose Increase verbosity. Can be specified multiple times. --quiet Don't be verbose (Overrides previous uses of --verbose). -C, --config FILE Use the specfied FILE for configuration instead of the default, /etc/slack.conf. -s, --source DIR Source directory for slack files -e, --rsh COMMAND Remote shell for rsync -c, --cache DIR Local cache directory for slack files -t, --stage DIR Local staging directory for slack files -r, --root DIR Root destination for slack files --no-sync Skip the slack-sync step (useful if you're pushing stuff into the CACHE outside slack). --no-files Don't install any files in ROOT, but tell rsync to print what it would do. --no-scripts Don't run scripts -n, --dry-run Same as --no-files --no-scripts (CACHE, STAGE will still be updated) --role-list Role list for slack-getroles(8). -b, --backup Make backups of existing files in ROOT that are overwritten. This option defaults to on if it is not set to 0 in a config file or disabled with --nobackup on the command line. --backup-dir Put backups from the --backup option into this directory. -H, --hostname HOST Pretend to be running on HOST, instead of the name given by gethostname(2). --preview MODE Do a diff of scripts and files before running them. MODE can be one of 'simple' or 'prompt' (See PREVIEW MODES, below). --diff PROG Use this diff program for previews. --sleep TIME Randomly sleep between 1 and TIME seconds before starting operations. Useful in crontabs. PREVIEW MODES
Preview functionality is new in slack 0.14.0. I haven't quite worked out how things will work, so this usage is somewhat subject to change in future versions. I thought I would try it this way and see how people like it. In 'simple' mode, after syncing and staging the files directory, slack will present a diff of the files and scripts. In this mode, slack will not run the preinstall or fixfiles scripts, and because of this, it may provide some false output about permissions changes to files. In 'prompt' mode, after syncing and staging the files directory, slack will diff the script directory. If there are differences, slack will present them to you and ask you if you want to continue. If you say no, it will exit. If you say yes, it will stage the scripts directory, run the preinstall and fixfiles scripts, and then diff the files in the stage with those in the root. If there are differences, slack will present them to you and ask you if you want to continue. If you say no, it will exit. If you say yes, it will install the files and run the postinstall script. So, the 'simple' mode is easy to use, and will be accurate if you don't use fixfiles. The 'prompt' mode will be accurate if you use fix- files, but requires some interaction. Why can't we just have one mode that works with fixfiles and requires no interaction? Well, that would require slack to understand what your free-form fixfiles executable was going to do, which would either require some kind of universe simulator or would require you to write your fixfiles in a less free-form way, which would make slack less like slack. EXAMPLES
To install all the roles configured in the role list for a server: slack To install a specific role: slack rolename To test a new role before checking in the changes: slack --source user@workstation:/home/user/.../slack rolename To avoid killing your master server when calling from cron: slack --sleep 3600 FILES
/etc/slack.conf SEE ALSO
slack.conf(5), rsync(1) Administrative commands 2004-10-22 slack(8)
All times are GMT -4. The time now is 08:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy