echo "Please enter four numbers: \c"
read max
for i in 1 2 3 4
do
read number
[ $number -gt $max ] && max=$number
done
echo "The maximum is: $max"
When I run it, for example, I type 1 2 3 4 and it does nothing...
Hello,
I've been working with C trying to get factorials which I've successfully accomplished but my code needs to output an error message when inputting negative numbers, unfortunately my code outputs an error when using 1 and 0.
This is what my code looks like (keep in mind I'm a beginner user so my code is simple).
#include <stdio.h>
int main()
Hello there, I am posting to seek help with a KSH script,
I am making a simple calculation program where the user can enter as many numbers as they like, I am getting their input using the read command, however I am not sure how to repeat doing this and storing the input in to new variables until the user wants the program to calculate.
Here is what I have so far
Code:
#!/bin/ksh
Hi all, I am reading through the Non-Programmer's Tutorial and I would like to make a program with Python in which is similar to the one in the example.
I need to calculate the biggest number in array size n.
Example: Users enter: 1 7 4 9
The biggest number is : 9
Simple but I'm really new on this on Shell/Bash! Anything will be helpful! Thanks!
Hi All
I am new to this forum and also regex.
I am using bash scripting and have a file like this
Code:
"0012","efgh","12345678","adfdf", "36598745"
"87654321","hijk","lmno"
I want the ouput to be
Code:
12345678
36598745
87654321
Criteria like this
- number
- 8 carachters long
Please let me know what reg
Hi,
I'm having some trouble with using "case...esac" in Bash.
I've googled it and am stuggling to understand the syntax and how to do certain things.
Firstly, I want to be able to choose a case based on a variable number
For example, I have in my code a place where a user can enter a number using read.
Code:
read SEL
Then I want to use a case to decide what should be don
Hi!
Let's say I would like to convert "1", "2", "3" to "a", "b", "c" respectively.
Hi, I'm trying to make a program that prompts for input a certain number of times, like say the user inputs 5, it will prompt for other input five times. I get the number from the user, but how do I make a for loop that uses that variable instead of a number?
This is one of the things I tried, but it doesn't work. Any help please? Thank you!