Questions tagged [bourne-shell]

12 questions
3
votes
9 answers

sh scripting: how to mount a remote filesystem if it is not mounted?

In a bourne shell script (#!/bin/sh) how can check to see if a remote NFS share is mounted and, if it is not, mount it? I've got an ugly set of cat, greps and ifs using the output of 'mount' at the moment but it doesn't seem to be doing a reliable…
DrStalker
  • 6,676
  • 24
  • 76
  • 106
2
votes
1 answer

Can't figure out how to automatically set MariaDB root password without user intervention

I'm making a script that installs MariaDB, and I'd like to set a root password. I've got the following in said script: DEBIAN_FRONTEND=noninteractive echo mariadb-server-10.0 mariadb-server-10.0/root_password password tmpsetup |…
ffxsam
  • 383
  • 2
  • 3
  • 9
2
votes
2 answers

difference between braces and normal brackets in bash?

what is the difference between braces and normal brackets in bash? FYI... I did not get it in the related questions list and also not able to locate it in questions search. Please point me to the question if it has been already asked.
BHS
  • 121
  • 1
  • 5
1
vote
1 answer

Setting enviromental variables for login shells under root account in FreeBSD

I am currently in the process of configuring Open Grid Scheduler in FreeBSD. As part of this process I need to set the environmental variableSGE_ROOTas root. To do this I have been experimenting with attempting to set this value through the root…
user225584
1
vote
2 answers

append & to the end of the particular command which I execute

I wish to append & sign to the end of particular command (say tkdiff) whenenver I execute the command. Please let me know what kind of alias / any other solution should I create in bashrc. Thanks in advance. Note: I may have few arguments to the…
kumar
  • 423
  • 2
  • 9
  • 23
1
vote
4 answers

How to check / start a process | error in shell script

If want to check if a process is running and start it if not. My script below is buggy and always says that a process is running. What is wrong? $ ./check_n_run thisisnotrunning ./check_n_run: thisisnotrunning is already running Here is the…
supercobra
  • 1,485
  • 2
  • 11
  • 9
1
vote
5 answers

selective backup script in bash

I've been using this simple command (that's all I can do :) to backup the whole tree from my user data in NAS server for a year. cp -r /STORAGE /BACKUP-STORAGE/YYYY-MM-DD Unfortunately, after a year of service. My user start filling the spaces with…
Sake
  • 417
  • 3
  • 5
  • 12
1
vote
2 answers

CRON job erratic behavior with Bourne shell script

I have the following script, that runs normally when I type the script name at the prompt (logscript): #!/bin/sh dvar=`date +"%m\/%d\/%y"` filedate=`date +%b%d%Y` echo DSS1 > serverlog_${filedate}.txt grep "^$dvar" oasErrLog >>…
Lance Roberts
  • 401
  • 3
  • 12
  • 29
0
votes
1 answer

ubuntu shell(sh) script missing some line

I create some script for a static route, called "my.rc.route" and i put it on /etc/rc.local, so everytime the server get restarted the script shall run after all the startup process. I feel a bit strange to find there were some line on my script…
Ta Coen
  • 240
  • 4
  • 13
0
votes
3 answers

Other than .profile, where do shell environment variables get defined?

Using Bourne shell on Solaris 10, there are many environment variables defined that are not in the .profile. Where and how do these get defined?
Brian Walsh
  • 43
  • 1
  • 7
0
votes
4 answers

How to resolve a path's correct ending?

I got a shell variable holding this path /usr/share/man/man1/bitmap.1 There COULD be a file named bitmap.1, but it could also be bitmap.1.z, bitmap.1.gz, bitmap.1.Z. Now I want to pass the real file to a function while at the same time resolving…
Trollhorn
  • 203
  • 3
  • 9
0
votes
2 answers

Remove parts of a path using parameter expansion... but how?

I need to remove the part man1/bmtoa.1.gz from the full path /usr/share/man/man1/bmtoa.1.gz so that it results in /usr/share/man/ I've tried ${path#[!/]*/*} and ${path#/*/*} but both result in wrong paths.
Trollhorn
  • 203
  • 3
  • 9