Questions tagged [shell-scripting]

Programming in an Interpreted language executed by a running Shell

Generic programming in an Interpreted language (as opposed to compiled) executed by a running Shell. Sometimes referred to as "Glue Code" due to the practice of managing the execution and output of one or more compiled binaries and passing said output to another series of commands.

621 questions
0
votes
1 answer

Linux/Solaris verification ( after hostname change ) in files according to hostname rule

According to the following Perl command ( this command part of ksh script ) I can replaced old hostnames with new hostnames in Linux or Solaris previos_machine_name=linux1a new_machine_name=Red_Hat_linux1a export previos_machine_name export…
yael
  • 2,433
  • 5
  • 31
  • 43
0
votes
2 answers

linux\solaris + print specific date format from file

subject - print file date on solaris as format: yymmdd ( yy - year , mm - month , dd - day ) on Linux machine I type the following command in order to get: file date as the following: ls -l --time-style=+%Y%m%d /etc/hosts | awk '{print $6}' …
yael
  • 2,433
  • 5
  • 31
  • 43
0
votes
2 answers

How to add a variable into a grep command

I'm running the following grep command var=`grep -n "keyword" /var/www/test/testfile.txt` This work just as expected but I need to insert the file name dynamically from a loop like so: var=`grep -n "keyword" /var/www/test/`basename…
twigg
  • 154
  • 1
  • 4
0
votes
2 answers

linux/solaris + how to verify OS (linux / solaris ) creation date

Please advice – how to verify OS (linux / solaris ) installation creation date which file/packages/other – can be good indication when the operation system was created/installed ? For example I installed the linux 5.5 in date 23/10/2012 , How to…
yael
  • 2,433
  • 5
  • 31
  • 43
0
votes
1 answer

solaris + manipulate lltconfig command

I work on Solaris 10 machines (eg de1a and du1b). Regarding the lltconfig command, is it possible to view only one device (eg NIC e1000g0) and not the entire list? For example I want to get only status about e1000g0, something like the following: …
yael
  • 2,433
  • 5
  • 31
  • 43
0
votes
1 answer

SFTP download the files and then i wanted rename the server files how to do this?

I have to setup with the banking interface where I need to connect to the remote bank and then download the files in the bank server in-box to my local server for further processing so i do following sftp commands in the crontab sftp -b…
mahen3d
  • 4,342
  • 14
  • 36
  • 57
0
votes
2 answers

How to hide/masquerade password in script

I use the following script to change Open Directory (Apple's LDAP) passwords. I don't like leaving the actual password within the script -- is there any way to hide or masquerade this so the script can be used by other users, but in a way they…
Dan
  • 141
  • 1
  • 6
0
votes
4 answers

Assigning environment variables for CRON

I have a .sh script that creates a .tar.gz file and transfer's it to a remote server using RSA keys for authentication. The script will run from terminal but it will not when I try to set it up as a Cron job. I receive an email from the Cron Daemon…
Ríomhaire
  • 103
  • 3
0
votes
1 answer

expect script + write "if" in expect script

please advice what's wrong with my exepct syntax ( I run expect in ksh script on Solaris 10 machine ) I want to verify if OS is linux so if it true the expect check if prompt is "#" or ">" and then run the "ls" command but I get the error…
yael
  • 2,433
  • 5
  • 31
  • 43
0
votes
3 answers

Files copying between servers by creation time

My bash scripting knowledge is very weak that's why I'm asking help here. What is the most effective bash script according to performance to find and copy files from one LINUX server to another using specifications described below. I need to get a…
0
votes
2 answers

Shell script to fix bad filenames?

I'm IT at my small firm; and, despite my dire warnings, everyone puts files on the server with awful names, including leading & trailing spaces, bad characters (including \ ; / + . < > - etc!) They do this by accessing the (FreeBSD/FreeNAS) server…
Dan
  • 959
  • 5
  • 14
  • 25
0
votes
2 answers

syntax error near unexpected token `then'

I created bash script wich works as Nagios plugin. Here is a part of it: 44 CURDUPLEX=`ethtool $IFACE|grep "Duplex"|cut -d ':' -f 2|xargs` 45 CURSPEED=`ethtool $IFACE|grep "Speed"|cut -d ':' -f 2|xargs|sed 's/.\{4\}$//'` 46 47 if [ $CURSPEED…
Evgenii Iablokov
  • 660
  • 2
  • 9
  • 15
0
votes
2 answers

How do I parse a log file for one hour with a simple shell script?

How do I parse a log file using only a shell script, for last one hour? Each hour, the script should execute, parse the previous hour's logs, and the already alerted or listed errors should not repeat. Error log example given below: 120622 13:06:36…
ara
  • 11
  • 1
  • 2
0
votes
3 answers

How to join a variable number of lines

I have a file with Feature names and a variable number of usernames below: Feature1 user1 user2 Feature2 user3 I'd like to be able to move the usernames to the same line as the Feature name (along the lines of the vi join command). The Feature…
0
votes
2 answers

expect + how to install expect on solaris

subject - install expect on solaris in order to write expect scripts details from my machine: uname -a SunOS 5.10 Generic_139555-08 sun4v sparc SUNW,Netra-T5220 I installed Solaris machine ( Solaris 10 ) , and then I installed successfully the…
Eytan
  • 611
  • 6
  • 13
  • 27