1,978 Topics

Member Avatar for
Member Avatar for Leela2403

I have to run some shell scripts in Windows using Cygwin. I am able to achieve that using %BASH% --login -i "/cygdrive/d/script.sh", where %BASH% is an environment variable in Windows set to C:\cygwin\bin\bash.exe. I have a created a Cygwin environment variable $EXE_PATH = /cygdrive/d/somepath/dir. Inside my script the line is …

0
173
Member Avatar for manujkathuria

Hi i am trying to send email using linux mail command, it does not show any error but its not delivering to the recipient, i am using redhat 5.8 and the command i used is echo "Hi" | mail -s 'Hi' username@gmail.com do i need to configure any redhat file …

Member Avatar for rch1231
0
99
Member Avatar for lewashby

In the following script I can't get the variable STARTPOINT to increment by 3 each time through the loop. I con't get it because the variable NUMBEROFGROUPS is incrementing by -1 each time and both increment lines look identical to me. #!/bin/bash set -x leading_zeros() { local NUM=${1} local NUMBEROFDIGITS=${2} …

Member Avatar for rch1231
0
167
Member Avatar for erezz

Hi, I have a log file contain 28 lines, 1-I need to grep the line with the size next to that i need to grep the name from the line Example: Size element 1. 906K ykms2 2. 1.2M ykps1 2-if one or more of the lines are missing I need …

Member Avatar for erezz
0
211
Member Avatar for manujkathuria

Hi, I would like to write a script to scp files from 1 server to other but the problem is if scp fails maybe because of server crash or somthing like that, i would like to start scp from the last file. i dont want to copy all the files …

Member Avatar for L7Sqr
0
115
Member Avatar for ms061210

Hi, I am creating a program that will validate if the user input date is correct. My problem is checking the month, 1. Is it possible to save the all the months in an array and then check the array if the user input is correct. 2. How can it …

Member Avatar for lewashby
0
209
Member Avatar for lewashby

The following line of code should result in GROUPS holding a number from 1 to probably 4 or 5. I need the next line to simply add 1 to whatever this lines results to. I've tried a lot of tings in bash but I can't make it happen. Any ideas? …

Member Avatar for L7Sqr
0
108
Member Avatar for lewashby

I've got an array CALENDER=(31 28 31 30 31 30 31 31 30 31 30 31) I have two if statements that Need to get an index from the array above but when I feed a value into the brackets e.g. ${CALENDER[${SECONDDIGIT}]} or ${CALENDER[${FIRSTDIGIT}]} it seems to only be getting …

Member Avatar for lewashby
0
119
Member Avatar for lewashby

I wrote the following script to try and get validate if a date was valid or not. I think I've about got the script done but I'M having some trouble getting the values from the array. When I input 11291985 into the program I'M getting "29 is invalid" I can't …

Member Avatar for lewashby
0
125
Member Avatar for ziyaddinsadigov

Hi, I watched some shell scripting codes and I saw that there is a command, which name is LISTEN. What is the logic of this command and how I can use it?

Member Avatar for rch1231
0
166
Member Avatar for lewashby

I'M trying to test a function that would be able to determine if it was or was not leap year. I believe my problem lies in the if statement but due to my lack of knowledge concerning shell I don't know what else to do here. #! /bin/bash read -p …

Member Avatar for Watael
0
190
Member Avatar for 3e0jUn

How do you start a SSH server on localhost through executing a shell script? If so, is there any way to restrict the commands performed or use another shell script as it's default console (i.e. Instead of Terminal.app it uses X11)?

Member Avatar for 3e0jUn
0
112
Member Avatar for lewashby

Below is a program I'M trying to write that will take an 8 digit date and validate whether or not it's a valid date. I'M very new to shell scripting so I really a have no idea what I'M going. Could you take a look and let me know what …

0
120
Member Avatar for nivarshn

Hi,I am using following code for FTP in shell script file and it is working.Now I want to migrate from FTP to SFTP.What code changes/steps I have to perform for SFTP ? ftp -in <<FIN open $SAP_UP_SERVER user $SAP_UP_USER $SAP_UP_PASSWORD asc put $PM00_OUTPUTS_DIRECTORY/$SAP_UP_FILE_CSV /$SAP_UP_FILE_CSV put $PM00_OUTPUTS_DIRECTORY/$SAP_UP_FILE_CTL /$SAP_UP_FILE_CTL prompt ... End …

0
104
Member Avatar for lewashby

I'M trying to write a small program that will validate weather or not a string is valid. Assuming that the date will always be 8 digits (12/21/2012) I need a function that will count the number of digits in a string. What I've got below is only returning "'is not …

Member Avatar for Watael
0
138
Member Avatar for ziyaddinsadigov

I saw that github commands in linux terminal always uses word "git" before all it's commands. How to use my own word for my shell script? for example, $ git commit or $ git status

Member Avatar for L7Sqr
0
187
Member Avatar for vikarna

I have a text file for ex: ABCD#sh run aaaaaaaaa bbbbbbbbb ccccccccc ABCD#sh int dddddddd eeeeeeee ABCD#sh xvy and so on.... I want to parse the lines between ABCD# and the next ABCD#. And send this parse output to CSV file or excel like aaaaaaaa dddddddd bbbbbbbb eeeeeeee cccccccc Please …

Member Avatar for Watael
0
117
Member Avatar for Akira01

OK so I am basically brand new to shell scripts and new to Unix in general. I have a server that has two profiles, one is a shared account for a few friends and I and the other is one that I use to run video game servers off of. …

0
104
Member Avatar for akileshb

How to pass password using scp in commandline SCP <filename> <user>@<Toserveraddress>:<path> Here i want to use password also , how can i use ????

Member Avatar for Taywin
0
360
Member Avatar for lena1990

needed help how can i connect to my oracle database using shell script and how can i assign particular value in table to a variable defined in shellscript and i use sqlplus but i get error

Member Avatar for Watael
0
447
Member Avatar for lena1990

hi i want to display only elements of array tht start with a number can i do that using egrep"

Member Avatar for pritaeas
0
70
Member Avatar for it@61@sec

I have a bash script (test.sh) which reads parameters from the command line. The parameters could look like this: param1 param2 param3&ext param4 param5 The problem is that when the script reads the parameters and then echo them I get the following: param1 param2 param3 No command 'ext' found did …

Member Avatar for it@61@sec
0
970
Member Avatar for niksirat

Hi every one, I have a question. I have many files with this format: a...a-Cb...b-d...d a...a-b...b-Cd...d a...a-b...b-Cd...d-e...e so that : 1- a...a is a number with **m** digits, 2- b...b is a number with **n** digits, 3- d...d is a number with **p** digits, 4- e...e is a number with …

Member Avatar for rubberman
0
189
Member Avatar for jpreem

So Im using our university servers through an ssh connection. I have a bunch of files in a directory which I would like to run through a perl script. So I thought this simple script I concocted should do the trick. I have used similar script on my home computer …

Member Avatar for jpreem
0
334
Member Avatar for ms061210

Hi. I want to create my date format but i dont know how. I want the user to input the date in format DD-MON-YY or else it will give him an error. How can I do that? any algorithm? ANy help would be appreciated. Thanks!

Member Avatar for Watael
0
91
Member Avatar for vikarna

echo "show run" the above commands gives input to terminal of router and then displays output on terminal. i want the output of this specific command to be redirected to the file. please help me

Member Avatar for Watael
0
139
Member Avatar for stharmon

Hi All, I am sed and awk illiterate and needed some assistance. I would like to write a script that will have sed replace all spaces with \space. For example. Program Files would be... Program\ Files I can figure out how to replace the space with a backslash, however, when …

Member Avatar for wickedjargon
0
233
Member Avatar for ms061210

Hi, I am creating my project and I really need some help from you guys. I am creating a form, which will be save in a file. MY question is, is it possible to view the first question then the user should answer it first before the next question popped …

0
81
Member Avatar for biscayne

I have a flat file (template) where I want to replace variables based upon value in another file (csv). Variables in them template are named %VAR_Xz% The values are in the csv file and X is field 0 of each line and y field 1 and up. Example: Badidas, 13.00, …

0
111
Member Avatar for lena1990

hi guys i want to create that read from a text file to print the content of the file but i has the following error /te.txt: No such file or directory you should know that i install ubunto on vmware and the te.txt file i put it in the home …

Member Avatar for Watael
0
99
Member Avatar for k2k

I udnerstand that setting up a public/private key authentication is a way to go when automating scp copy files to target machines. however, I just now just to get a quick a dirty way to copy a number of files to a number of remote machines. My question is how …

0
71
Member Avatar for rev_ollie

Hi, I'm trying to write a "quick" powershell script to end processes passed as arguments: $args $check = Get-process $args foreach ($arg in $args) { if ($check -eq $null) { Write-host $arg " - Its not running" } else { Write-host $arg " - It's running" } } I'm trying …

0
66
Member Avatar for hanvyj

Hi, I'm trying to get a bunch of files off an ftp server. I connect fine: batch script: ftp -v -s:"C:\Documents and Settings\xxxx\Desktop\download.txt" xx.xx.xx.xx and download.txt: xxxx xxxx lcd "D:\Data\FileDump" cd "backup" mget *.* It runs fine until it gets to the mget *.* and then it just outputs all …

Member Avatar for hanvyj
0
140
Member Avatar for dharmendra1986

I have a .sh script which is as follows. #/bin/bash ssh uname@111.XXX.111.XXX | mysqldump -u uname -p test_db>/home/dm/Downloads/test.sql # script ended I want to extract the script from the server "111.XXX.111.XXX" and keep it in a server directory but I do not want to log in to the server. So, …

0
164
Member Avatar for amnakhan786

hi, i am trying to parse a collection of text files that look like following. there a number of them but not all are structured exactly the same way.if i figure to parse this file i can handle the rest.i am novice in bash, and i want to parse the …

0
98
Member Avatar for dharmendra1986

I have a shell script like as follows #!/bin/bash # Downloading Dumps from the production server. Date=`date +'%d-%m-%y-%H-%M'` BACKDIR=/home/tmp/Backup #IP Address of the Server Host="localhost" #User Name USER="root" #Database Name DBS="test_db" echo "Backing up MySQL databases..." echo "Time: `date`" mysqldump -h $HOST -v --user=$USER --password=$PASS $DBS test_tbl1 test_tble2 ...... > …

0
130
Member Avatar for woodson2

Below is a simple script to prompt for user input while suggesting an editable default value at the prompt: shortname=user1 read -e -i $shortname -p "Please enter the username you would like to add: " input USERNAME="${input:-$shortname}" Please enter the username you would like to add: user1 The above is …

0
53
Member Avatar for riahc3

Hello I want to make a simple bat file in Windows 7 but the command (route) only works in admin mode so I would have to ask for admin premissions. How do I do this in a bat file? Thank you

Member Avatar for riahc3
0
112
Member Avatar for lena1990

i want to create a shell script that divide a text file to parts and take the information from each part and store it

Member Avatar for Watael
0
99
Member Avatar for observ

I have an batch script that needs to concatenate several hundred of lines (72 chars) in one long line for base64 to decode. He used line reading because of the windows XP line limit (8191 chars per line). The script currently has 2 issues at result: It exports with 2xquote …

0
177
Member Avatar for Ashley1966

This script is supposed to ssh to the server, which it does and then it supposed to say "case is correct" on the name of the server that the person entered if the case is correct (upper or lowercase). However, it works except that it never returns a servername. I …

Member Avatar for Watael
0
114
Member Avatar for ivan.lilo.rybansky

Hi, i have to write/as homework/ a script that shows list of all users ,users belong to group (which is main group for every user has been showed) defined as parameter of script. In the case of -c, show count of those users. TIP: /etc/passwd, /etc/group

Member Avatar for Watael
0
235
Member Avatar for stupendousomega

I understand that variables are global unless otherwise stated local, but for some reason, (and it's probably my own stupidity) it's not working. I have searched around to no avail. #!/bin/bash function a { echo $1 } echo $1 a Say you pass the word car to it. It should …

Member Avatar for Watael
0
142
Member Avatar for kgal

I'm trying to write a program that will ask the user to input the number of values he wants, prompt him for the values and then print out the maximum value and the minimum value. This is what I have so far: count=1 echo "Enter number of integers" read n …

Member Avatar for 1234brut
0
707
Member Avatar for shreya19

Which command is used to copy all files having the string chap and any two characters after that to the progs directory?

Member Avatar for Watael
0
103
Member Avatar for harpoon35

Hello, I was trying to combine some commands but having a little trouble. In a single command I want to call the script dvdcoll2 and accept input from dvdcoll1. Then I want to put stdout into dvdcoll3, and stderr into dvderror. How do I string together four commands in a …

Member Avatar for Watael
0
105
Member Avatar for kandarpa

Hi there, I want to check whether a file is a link or not. Eg: I have a directory structure as follows: mkdir -p abc/bcd/cde/def touch abc/bcd/cde/def/file cd abc/ ln -s bcd link Now, abc/link/cde/def/file is actually not a file. Its a link Now I want to remove this file …

Member Avatar for Watael
0
210
Member Avatar for overwraith

I am working on a "for loop that finds all the drives on a system that match a given criteria and am trying to accumulate the drive letters into a list(string) which I can then pipe to a command which will do something to those drives. I do not use …

Member Avatar for overwraith
0
227
Member Avatar for samsons17

Hi there, I have the xml file (HSBB_voice_20120925_0000000182.cdr.bc_lerr.xml) that contains data between tags that i want to extract. The sample data from the xml file that i have etracted is like below : ----------------------------------------------------------------------------------- <record record_no = "62" error_code="100">D20|000000063|56604960 071411E2 BC9D24B6 FDB63DEA|6088342010|0166662635|DEFAULT|1348579536|1348579538|3|0|IDD|Flat Rate <record record_no = "63" error_code="100">D20|000000064|7A257C4E 071411E2 BC9D24B6 …

Member Avatar for Watael
0
189
Member Avatar for vishankparikh

Q-1 Write a shell script in Unix that lists files from your current working directory · By modification time when called with lm · By access time when called with la. By default, the script should show the listing of all the files in the current directory. Q-2 Write a …

Member Avatar for sbesch
0
149

The End.