How do I translate 1-26 to a-z in BASH?Get the source directory of a Bash script from within the script itselfHow to check if a string contains a substring in BashHow to check if a program exists from a Bash script?How do I tell if a regular file does not exist in Bash?How do I split a string on a delimiter in Bash?Extract filename and extension in BashHow to concatenate string variables in BashReliable way for a Bash script to get the full path to itselfEcho newline in Bash prints literal nBash script and /bin/bash^M: bad interpreter: No such file or directory

Dissuading my girlfriend from a scam

Why does 8 bit truecolor use only 2 bits for blue?

Is it right to use the ideas of non-winning designers in a design contest?

Why are there no wireless switches?

Does the word voltage exist in academic engineering?

How do draw effects during the discard phase work?

Let A,B,C be sets. If A△B=A△C, does this imply that B=C?

Filling attribute tables with values from the same attribute table

What does "先が気になる" mean?

How do I write a vertically-stacked definition of a sequence?

If every star in the universe except the Sun were destroyed, would we die?

What makes an ending "happy"?

What quests do you need to stop at before you make an enemy of a faction for each faction?

Is there some sort of French saying for "a person's signature move"?

How can I know what hashing algorithm SQL Server used to decrypt the encrypted data when using the function DECRYPTBYPASSPHRASE?

Compiler optimization of bitwise not operation

Should I tip on the Amtrak train?

Sinning and G-d's will, what's wrong with this logic?

Did the Byzantines ever attempt to move their capital to Rome?

Python reimplementation of Lost In Space by Tim Hartnell

Did "Dirty Harry" feel lucky?

I won a car in a poker game. How is that taxed in Canada?

Are fast interviews red flags?

Poor management handling of recent sickness and how to approach my return?



How do I translate 1-26 to a-z in BASH?


Get the source directory of a Bash script from within the script itselfHow to check if a string contains a substring in BashHow to check if a program exists from a Bash script?How do I tell if a regular file does not exist in Bash?How do I split a string on a delimiter in Bash?Extract filename and extension in BashHow to concatenate string variables in BashReliable way for a Bash script to get the full path to itselfEcho newline in Bash prints literal nBash script and /bin/bash^M: bad interpreter: No such file or directory






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















This is a part of a comp sci homework question.



I want to translate [1-26] to [A-Z] using a bash script.



#/bin/bash
if [ $1 = -u ] && [ $2 = -s ];then
#statements
echo $3 | tr '[1-26]' '[A-Z]'
fi


don't worry too much about about the if statement, thats part of the question I am working on.



When I run ./file.sh -u -s 2
The output is



B


But when I run ./file -u -s 16
The output is



A6


I want it to output



P









share|improve this question
























  • What will be the output of ./file.sh -u -s 216?

    – oguz ismail
    Mar 28 at 6:20











  • well it was unexpected but it gives me BAC

    – Juan Pablo
    Mar 28 at 6:21











  • What is the expected output of it?

    – oguz ismail
    Mar 28 at 6:26











  • undefined? 216 is greater than 26 so nothing I guess

    – Juan Pablo
    Mar 28 at 6:34






  • 1





    Not easily (if at all) with tr.

    – choroba
    Mar 28 at 7:02

















1















This is a part of a comp sci homework question.



I want to translate [1-26] to [A-Z] using a bash script.



#/bin/bash
if [ $1 = -u ] && [ $2 = -s ];then
#statements
echo $3 | tr '[1-26]' '[A-Z]'
fi


don't worry too much about about the if statement, thats part of the question I am working on.



When I run ./file.sh -u -s 2
The output is



B


But when I run ./file -u -s 16
The output is



A6


I want it to output



P









share|improve this question
























  • What will be the output of ./file.sh -u -s 216?

    – oguz ismail
    Mar 28 at 6:20











  • well it was unexpected but it gives me BAC

    – Juan Pablo
    Mar 28 at 6:21











  • What is the expected output of it?

    – oguz ismail
    Mar 28 at 6:26











  • undefined? 216 is greater than 26 so nothing I guess

    – Juan Pablo
    Mar 28 at 6:34






  • 1





    Not easily (if at all) with tr.

    – choroba
    Mar 28 at 7:02













1












1








1








This is a part of a comp sci homework question.



I want to translate [1-26] to [A-Z] using a bash script.



#/bin/bash
if [ $1 = -u ] && [ $2 = -s ];then
#statements
echo $3 | tr '[1-26]' '[A-Z]'
fi


don't worry too much about about the if statement, thats part of the question I am working on.



When I run ./file.sh -u -s 2
The output is



B


But when I run ./file -u -s 16
The output is



A6


I want it to output



P









share|improve this question














This is a part of a comp sci homework question.



I want to translate [1-26] to [A-Z] using a bash script.



#/bin/bash
if [ $1 = -u ] && [ $2 = -s ];then
#statements
echo $3 | tr '[1-26]' '[A-Z]'
fi


don't worry too much about about the if statement, thats part of the question I am working on.



When I run ./file.sh -u -s 2
The output is



B


But when I run ./file -u -s 16
The output is



A6


I want it to output



P






bash






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 28 at 6:16









Juan PabloJuan Pablo

437 bronze badges




437 bronze badges















  • What will be the output of ./file.sh -u -s 216?

    – oguz ismail
    Mar 28 at 6:20











  • well it was unexpected but it gives me BAC

    – Juan Pablo
    Mar 28 at 6:21











  • What is the expected output of it?

    – oguz ismail
    Mar 28 at 6:26











  • undefined? 216 is greater than 26 so nothing I guess

    – Juan Pablo
    Mar 28 at 6:34






  • 1





    Not easily (if at all) with tr.

    – choroba
    Mar 28 at 7:02

















  • What will be the output of ./file.sh -u -s 216?

    – oguz ismail
    Mar 28 at 6:20











  • well it was unexpected but it gives me BAC

    – Juan Pablo
    Mar 28 at 6:21











  • What is the expected output of it?

    – oguz ismail
    Mar 28 at 6:26











  • undefined? 216 is greater than 26 so nothing I guess

    – Juan Pablo
    Mar 28 at 6:34






  • 1





    Not easily (if at all) with tr.

    – choroba
    Mar 28 at 7:02
















What will be the output of ./file.sh -u -s 216?

– oguz ismail
Mar 28 at 6:20





What will be the output of ./file.sh -u -s 216?

– oguz ismail
Mar 28 at 6:20













well it was unexpected but it gives me BAC

– Juan Pablo
Mar 28 at 6:21





well it was unexpected but it gives me BAC

– Juan Pablo
Mar 28 at 6:21













What is the expected output of it?

– oguz ismail
Mar 28 at 6:26





What is the expected output of it?

– oguz ismail
Mar 28 at 6:26













undefined? 216 is greater than 26 so nothing I guess

– Juan Pablo
Mar 28 at 6:34





undefined? 216 is greater than 26 so nothing I guess

– Juan Pablo
Mar 28 at 6:34




1




1





Not easily (if at all) with tr.

– choroba
Mar 28 at 7:02





Not easily (if at all) with tr.

– choroba
Mar 28 at 7:02












1 Answer
1






active

oldest

votes


















5
















You can use an array of characters and just specify an index:



chars=("", A..Z)
i=26
echo $chars[i] # Z





share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );














    draft saved

    draft discarded
















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55391213%2fhow-do-i-translate-1-26-to-a-z-in-bash%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    5
















    You can use an array of characters and just specify an index:



    chars=("", A..Z)
    i=26
    echo $chars[i] # Z





    share|improve this answer





























      5
















      You can use an array of characters and just specify an index:



      chars=("", A..Z)
      i=26
      echo $chars[i] # Z





      share|improve this answer



























        5














        5










        5









        You can use an array of characters and just specify an index:



        chars=("", A..Z)
        i=26
        echo $chars[i] # Z





        share|improve this answer













        You can use an array of characters and just specify an index:



        chars=("", A..Z)
        i=26
        echo $chars[i] # Z






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 28 at 6:26









        chorobachoroba

        168k17 gold badges148 silver badges219 bronze badges




        168k17 gold badges148 silver badges219 bronze badges





















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.




















            draft saved

            draft discarded















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55391213%2fhow-do-i-translate-1-26-to-a-z-in-bash%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현